mirror of
				https://github.com/flynx/Course-JavaScript.git
				synced 2025-10-31 12:00:08 +00:00 
			
		
		
		
	now both sides of the infix operator get execd...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
		
							parent
							
								
									4b01c1a383
								
							
						
					
					
						commit
						a19f69ca65
					
				| @ -129,7 +129,7 @@ NAMESPACE.print = function(context){ | ||||
| 
 | ||||
| 	var data = document.createElement('div') | ||||
| 	data.classList.add('output') | ||||
| 	data.innerHTML = o | ||||
| 	data.innerHTML = stringifySlangCode(o) | ||||
| 	c.appendChild(data) | ||||
| } | ||||
| 
 | ||||
| @ -179,7 +179,7 @@ function showAvailableWords(){ | ||||
| 			} | ||||
| 			return '<span class="word" builtin="'+builtin+'" title="'+code+'">'+e+'</span>' | ||||
| 		}) | ||||
| 		.join(', ') | ||||
| 		.join(' ') | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
|  | ||||
| @ -569,16 +569,18 @@ var BOOTSTRAP = [ | ||||
| '-- NOTE: these have both stack and code effect, in genera the operations are of ', | ||||
| '--		the form: A op B', | ||||
| '-- Here is an infix operator example...', | ||||
| '-- 	:: + ( a | b -- c |  ) [ \\ exec \\ add 2 1 _swapN ]', | ||||
| '-- 	:: + ( a | b -- c |  ) [ \\ exec 2 0 _swapN \\ exec \\ add 2 1 _swapN ]', | ||||
| '-- now let\'s make a meta function to make things shorter...', | ||||
| ':: _infix ( op word -- ) [', | ||||
| '		-- format the word definition...', | ||||
| '		s2b \\ :: -3 before b2s', | ||||
| '		-- our template...', | ||||
| 		// XXX the template is wrong: need to exec both sides...
 | ||||
| '		[ \\ exec \\ WORD 2 1 _swapN ] clone', | ||||
| '		-- exec the left side...', | ||||
| '		[ \\ exec 2 0 _swapN', | ||||
| '				-- exec the right side and arragne the args for WORD...', | ||||
| '				\\ exec \\ WORD 2 1 _swapN ] clone', | ||||
| '			-- replace WORD with the actual target word...', | ||||
| '			swap 3 to', | ||||
| '			swap 8 to', | ||||
| '		-- push to code / run', | ||||
| '		3 0 _swapN ]', | ||||
| '-- formatter for the _infix word...', | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user