-
Notifications
You must be signed in to change notification settings - Fork 3
/
j2ideas
20 lines (16 loc) · 847 Bytes
/
j2ideas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/*
<number> # numeric literal; <number>->TOS
[xyz a.b.c] # literal; ->TOS
TOS @<name> # apply name; TOS->dict
<name> # deref name; dict->TOS
TOS!<name> # for x matching <name>: eval(x TOS)
TOS(xyz a.b.c) # eval(xyz a.b.c TOS) in context of a lexically-scoped subdict
TOS<xyz a.b.c> # eval(xyz a.b.c) in context of TOS's subdictionary
{xyz a.b.c} # "flatten" contents of "{}"; recursively unpack literals/deref names.
Numeric literal can be considered a virtual dictionary entry that evaluates to itself.
For "!" and "()" eval operations, TOS is popped once and applied repeatedly for each iteration.
snippets:
[x]@a.b.c [y]@a.b.c # dict entries stack!
[xyz]!a.b.* # eval xyz for each a.b.*
[xyz]!5 # eval xyz 5 times (numeric lits not pushed to TOS)
*/