capitalex revisou este gist . Ir para a revisão
1 file changed, 83 insertions
map.nv(arquivo criado)
@@ -0,0 +1,83 @@ | |||
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 | + |
Próximo
Anterior