now both sides of the infix operator get execd...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2013-12-30 09:10:32 +04:00
parent 4b01c1a383
commit a19f69ca65
2 changed files with 8 additions and 6 deletions

View File

@ -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(' ')
}

View File

@ -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...',