From a19f69ca6508a82945b5585511779cbaad3fe3a7 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Mon, 30 Dec 2013 09:10:32 +0400 Subject: [PATCH] now both sides of the infix operator get execd... Signed-off-by: Alex A. Naanou --- Slang/slang.html | 4 ++-- Slang/slang.js | 10 ++++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Slang/slang.html b/Slang/slang.html index ce530bb..91b8252 100755 --- a/Slang/slang.html +++ b/Slang/slang.html @@ -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 ''+e+'' }) - .join(', ') + .join(' ') } diff --git a/Slang/slang.js b/Slang/slang.js index 43d2c17..5dd7eba 100755 --- a/Slang/slang.js +++ b/Slang/slang.js @@ -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...',