feat(inspect) Added inspect operator.
h3rald h3rald@h3rald.com
Fri, 03 Jun 2016 22:18:16 +0200
2 files changed,
13 insertions(+),
1 deletions(-)
M
lib/lang.nim
→
lib/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.min
→
tests/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