all repos — min @ 12fe4ab511b5fe1a2f48d16c9bea62ec82d9ebb4

A small but practical concatenative programming language.

feat(inspect) Added inspect operator.
h3rald h3rald@h3rald.com
Fri, 03 Jun 2016 22:18:16 +0200
commit

12fe4ab511b5fe1a2f48d16c9bea62ec82d9ebb4

parent

351a30229fb6d9ff6e37eabdad305194f330d276

2 files changed, 13 insertions(+), 1 deletions(-)

jump to
M lib/lang.nimlib/lang.nim

@@ -181,6 +181,16 @@ return

i.scope = q.scope i.scope = origScope + + .symbol("inspect") do (i: In): + let scope = i.pop + if not scope.isQuotation: + i.error errNoQuotation + var symbols = newSeq[MinValue](0) + for s in scope.scope.symbols.keys: + symbols.add s.newVal + i.push symbols.newVal + # Operations on the whole stack .symbol("clear") do (i: In):
M tests/lang.mintests/lang.min

@@ -3,7 +3,7 @@ #test

"lang" describe - (symbols size 159 ==) assert + (symbols size 160 ==) assert (sigils size 10 ==) assert

@@ -35,6 +35,8 @@ (defmod

(#mymath (-) :myminus) => .mymath 5 2 mymath %myminus 3 ==) assert + + (defmod mymath inspect ("myplus") ==) assert ((":mysigil" concat) ', sigil ,test "test:mysigil" ==) assert