Ultima attività 11 months ago

An example of adding basic variable bindings and binary math expressions to Nova.

june's Avatar june ha revisionato questo gist 11 months ago. Vai alla revisione

1 file changed, 5 insertions, 6 deletions

variables.nv

@@ -6,13 +6,12 @@
6 6 :: baz = baz + quux
7 7 :: baz = baz + baz
8 8
9 - |:: $x = $y $op $z :@math: $|
10 - :: $x = $
11 9
12 - |:: $x = $y + $z? :unbound: ($z $y)| :@math: add $y $z
13 - |:: $x = $y - $z? :unbound: ($z $y)| :@math: subtract $y $z
14 - |:: $x = $y * $z? :unbound: ($z $y)| :@math: multiply $y $z
15 - |:: $x = $y / $z? :unbound: ($z $y)| :@math: divide $y $z
10 + ||:@include: lib/rpn.nv
11 +
12 + |:: $x = $y $op $z :@rpn data: $|
13 + :: $x = $
14 + |:: $x = $y $op $z? :unbound: ($z $y)| :@rpn: ($y $z $op)
16 15
17 16 |:: $x = $y $op $z :variable: $y $|
18 17 :: $x = $ $op $z

wryl ha revisionato questo gist 11 months ago. Vai alla revisione

1 file changed, 59 insertions

variables.nv(file creato)

@@ -0,0 +1,59 @@
1 + ||:: foo = bar
2 + :: bar = baz
3 + :: baz = 2
4 + :: quux = foo
5 + :: baz = bar + foo
6 + :: baz = baz + quux
7 + :: baz = baz + baz
8 +
9 + |:: $x = $y $op $z :@math: $|
10 + :: $x = $
11 +
12 + |:: $x = $y + $z? :unbound: ($z $y)| :@math: add $y $z
13 + |:: $x = $y - $z? :unbound: ($z $y)| :@math: subtract $y $z
14 + |:: $x = $y * $z? :unbound: ($z $y)| :@math: multiply $y $z
15 + |:: $x = $y / $z? :unbound: ($z $y)| :@math: divide $y $z
16 +
17 + |:: $x = $y $op $z :variable: $y $|
18 + :: $x = $ $op $z
19 + |:: $x = $y $op $z? :unbound: $y|
20 +
21 + |:: $x = $y $op $z :variable: $z $|
22 + :: $x = $y $op $
23 + |:: $x = $y $op $z? :unbound: $z|
24 +
25 + |:: $x = $y $op $z?|
26 + :: get $y
27 + :: get $z
28 +
29 + |:: $x = $y :unbound: $y|
30 + :: set $x to $y
31 + |:: $x = $y :variable: $y $|
32 + :: $x = $
33 + |:: $x = $y?|
34 + :: get $y
35 +
36 + |:: get $x :variables: $x $y?|
37 + :variable: $x $y
38 + :: reset variables
39 + |:: get $x? :variables: $ $y|
40 + :skipped: $ $y
41 + |:: get $x|
42 + :unbound: $x
43 + :: reset variables
44 +
45 + |:: set $x to $y :variables: $x $|
46 + :variables: $x $y
47 + :: reset variables
48 + |:: set $x to $y? :variables: $n $|
49 + :skipped: $n $
50 + |:: set $x to $y|
51 + :variables: $x $y
52 + :: reset variables
53 +
54 + |:: reset variables? :skipped: $x $y|
55 + :variables: $x $y
56 + |:: reset variables|
57 +
58 + |:: clear variables? :variables: $x $y|
59 + |:: clear variables|
Più nuovi Più vecchi