mirror of
				https://github.com/flynx/Course-JavaScript.git
				synced 2025-10-31 20:10: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') | 	var data = document.createElement('div') | ||||||
| 	data.classList.add('output') | 	data.classList.add('output') | ||||||
| 	data.innerHTML = o | 	data.innerHTML = stringifySlangCode(o) | ||||||
| 	c.appendChild(data) | 	c.appendChild(data) | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| @ -179,7 +179,7 @@ function showAvailableWords(){ | |||||||
| 			} | 			} | ||||||
| 			return '<span class="word" builtin="'+builtin+'" title="'+code+'">'+e+'</span>' | 			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 ', | '-- NOTE: these have both stack and code effect, in genera the operations are of ', | ||||||
| '--		the form: A op B', | '--		the form: A op B', | ||||||
| '-- Here is an infix operator example...', | '-- 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...', | '-- now let\'s make a meta function to make things shorter...', | ||||||
| ':: _infix ( op word -- ) [', | ':: _infix ( op word -- ) [', | ||||||
| '		-- format the word definition...', | '		-- format the word definition...', | ||||||
| '		s2b \\ :: -3 before b2s', | '		s2b \\ :: -3 before b2s', | ||||||
| '		-- our template...', | '		-- our template...', | ||||||
| 		// XXX the template is wrong: need to exec both sides...
 | '		-- exec the left side...', | ||||||
| '		[ \\ exec \\ WORD 2 1 _swapN ] clone', | '		[ \\ 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...', | '			-- replace WORD with the actual target word...', | ||||||
| '			swap 3 to', | '			swap 8 to', | ||||||
| '		-- push to code / run', | '		-- push to code / run', | ||||||
| '		3 0 _swapN ]', | '		3 0 _swapN ]', | ||||||
| '-- formatter for the _infix word...', | '-- formatter for the _infix word...', | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user