map.nv
· 2.3 KiB · Text
Bruto
Playground
||
:: map :list: (1 2 3 4 5 6 7) :into: x
:with: x = x + 1
:with: x = x ^ 2
:with: x = x * 3
|:: map? :list: $x :into: $var?|
:@variables: set $var $x :@variables:
:: wait for @variables
:: apply operations
:: move $var to stash
:: next pass
|:: map? :into: $var|
|:: map? :with: $var = $var $op $value|
|:: map? :stash: $x|
:list: $x
|:: map|
|:: apply operations? :with: $var = $var $op $value|
:done: $var = $var $op $value
:: it <- $var
:: it <- it $op $value
:: it -> $var
|:: apply operations|
|:: move $var to stash :@variables result: $value|
:stash: $value
|:: move $var to stash?|
:@variables: get $var
:@variables: clear $var
:@variables:
:: wait for @variables
|:: next pass? :done: $var = $var $op $value|
:with: $var = $var $op $value
|:: next pass|
|:: it <- $var :@variables result: $value|
:it: $value
|:: it <- $var?|
:@variables: get $var :@variables:
:: wait for @variables
|:: it <- it $op $value :@math: $it|
:it: $it
|:: it <- it ^ $value? :it: $it|
:@math: multiply $it $it
|:: it <- it * $value? :it: $it|
:@math: multiply $it $value
|:: it <- it + $value? :it: $it|
:@math: add $it $value
|:: it -> $var :it: $it|
:@variables: set $var $it :@variables:
:: wait for @variables
|:@variables: reset :@variables seen: $var $value|
:@variables set: $var $value
|:@variables: reset|
| :@variables: set $variable $value :@variables set: $variable $other-value |
:@variables: reset :@variables set: $variable $value
| :@variables: set $variable $value :@variables set: $other-variable $other-value |
:@variables seen: $other-variable $other-value
| :@variables: set $variable $value |
:@variables set: $variable $value
| :@variables: get $variable :@variables set: $variable $value? |
:@variables: reset :@variables result: $value
| :@variables: get $variable :@variables set: $other-variable $other-value |
:@variables seen: $other-variable $other-value
| :@variables: get $variable |
:@variables: reset :@variables result: empty
|:@variables: clear $variable :@variables set: $variable $value|
:@variables: reset
|:@variables: clear $variable :@variables set: $other-variable $value|
:@variables seen: $other-variable $value
|:@variables: clear $variable|
|:@variables: :: wait for @variables|
|:@variables:|
1 | || |
2 | :: map :list: (1 2 3 4 5 6 7) :into: x |
3 | :with: x = x + 1 |
4 | :with: x = x ^ 2 |
5 | :with: x = x * 3 |
6 | |
7 | |:: map? :list: $x :into: $var?| |
8 | :@variables: set $var $x :@variables: |
9 | :: wait for @variables |
10 | :: apply operations |
11 | :: move $var to stash |
12 | :: next pass |
13 | |:: map? :into: $var| |
14 | |:: map? :with: $var = $var $op $value| |
15 | |:: map? :stash: $x| |
16 | :list: $x |
17 | |:: map| |
18 | |
19 | |:: apply operations? :with: $var = $var $op $value| |
20 | :done: $var = $var $op $value |
21 | :: it <- $var |
22 | :: it <- it $op $value |
23 | :: it -> $var |
24 | |:: apply operations| |
25 | |
26 | |:: move $var to stash :@variables result: $value| |
27 | :stash: $value |
28 | |:: move $var to stash?| |
29 | :@variables: get $var |
30 | :@variables: clear $var |
31 | :@variables: |
32 | :: wait for @variables |
33 | |
34 | |:: next pass? :done: $var = $var $op $value| |
35 | :with: $var = $var $op $value |
36 | |:: next pass| |
37 | |
38 | |:: it <- $var :@variables result: $value| |
39 | :it: $value |
40 | |:: it <- $var?| |
41 | :@variables: get $var :@variables: |
42 | :: wait for @variables |
43 | |
44 | |:: it <- it $op $value :@math: $it| |
45 | :it: $it |
46 | |:: it <- it ^ $value? :it: $it| |
47 | :@math: multiply $it $it |
48 | |:: it <- it * $value? :it: $it| |
49 | :@math: multiply $it $value |
50 | |:: it <- it + $value? :it: $it| |
51 | :@math: add $it $value |
52 | |
53 | |:: it -> $var :it: $it| |
54 | :@variables: set $var $it :@variables: |
55 | :: wait for @variables |
56 | |
57 | |:@variables: reset :@variables seen: $var $value| |
58 | :@variables set: $var $value |
59 | |:@variables: reset| |
60 | |
61 | | :@variables: set $variable $value :@variables set: $variable $other-value | |
62 | :@variables: reset :@variables set: $variable $value |
63 | | :@variables: set $variable $value :@variables set: $other-variable $other-value | |
64 | :@variables seen: $other-variable $other-value |
65 | | :@variables: set $variable $value | |
66 | :@variables set: $variable $value |
67 | |
68 | | :@variables: get $variable :@variables set: $variable $value? | |
69 | :@variables: reset :@variables result: $value |
70 | | :@variables: get $variable :@variables set: $other-variable $other-value | |
71 | :@variables seen: $other-variable $other-value |
72 | | :@variables: get $variable | |
73 | :@variables: reset :@variables result: empty |
74 | |
75 | |:@variables: clear $variable :@variables set: $variable $value| |
76 | :@variables: reset |
77 | |:@variables: clear $variable :@variables set: $other-variable $value| |
78 | :@variables seen: $other-variable $value |
79 | |:@variables: clear $variable| |
80 | |
81 | |:@variables: :: wait for @variables| |
82 | |:@variables:| |
83 | |
84 |