forall.nv
· 685 B · Text
Ham
Playground
||:@include: lib/rpn.nv
|:: push $x to $y|
:stacks: $y $x
|:: pop from $x :stacks: $x $y|
:item: $y
|:: pop from $x? :stacks: $y $z|
:seen: $y $z
|:: pop from $x|
:stack empty: $x
:: reset stacks
|:: reset stacks? :seen: $x $y|
:stacks: $x $y
|:: reset stacks|
|:: $x for all $y :stack empty: $y|
|:: $x for all $y?|
:: pop from $y
:: apply $x
|:: $x all $y| :: $x for all $y
|:: apply $x :stack empty: $y?|
|:: apply $x :item: $y|
:: $x $y
|:: sum $x :@rpn data: $y| :total: $y
|:: sum $x? :total: $y|
:@rpn: ($x $y +)
|:: sum $x?|
:total: 0
||:: push 10 to numbers
:: push 20 to numbers
:: push 30 to numbers
:: sum all numbers
| 1 | ||:@include: lib/rpn.nv |
| 2 | |
| 3 | |:: push $x to $y| |
| 4 | :stacks: $y $x |
| 5 | |:: pop from $x :stacks: $x $y| |
| 6 | :item: $y |
| 7 | |:: pop from $x? :stacks: $y $z| |
| 8 | :seen: $y $z |
| 9 | |:: pop from $x| |
| 10 | :stack empty: $x |
| 11 | :: reset stacks |
| 12 | |
| 13 | |:: reset stacks? :seen: $x $y| |
| 14 | :stacks: $x $y |
| 15 | |:: reset stacks| |
| 16 | |
| 17 | |:: $x for all $y :stack empty: $y| |
| 18 | |:: $x for all $y?| |
| 19 | :: pop from $y |
| 20 | :: apply $x |
| 21 | |:: $x all $y| :: $x for all $y |
| 22 | |
| 23 | |:: apply $x :stack empty: $y?| |
| 24 | |:: apply $x :item: $y| |
| 25 | :: $x $y |
| 26 | |
| 27 | |:: sum $x :@rpn data: $y| :total: $y |
| 28 | |:: sum $x? :total: $y| |
| 29 | :@rpn: ($x $y +) |
| 30 | |:: sum $x?| |
| 31 | :total: 0 |
| 32 | |
| 33 | ||:: push 10 to numbers |
| 34 | :: push 20 to numbers |
| 35 | :: push 30 to numbers |
| 36 | :: sum all numbers |