Last active 1748901835

capitalex's Avatar capitalex revised this gist 1748901835. Go to revision

1 file changed, 85 insertions

conditionals.nv(file created)

@@ -0,0 +1,85 @@
1 + |::|
2 + :keyword for 'if': then
3 + :keyword for 'end': end
4 + :keyword for 'else': else
5 + :keyword for 'fail': false
6 +
7 + | :keyword for 'fail': $fail? :: $fail?
8 + :keyword for 'if': $if? :: $if |
9 + :conditional depth:
10 + | :keyword for 'fail': $fail? :: $fail?
11 + :keyword for 'else': $else? :: $else
12 + :conditional depth:? :conditional depth:? |
13 + | :keyword for 'fail': $fail? :: $fail
14 + :keyword for 'else': $else? :: $else
15 + :conditional depth: |
16 + | :keyword for 'fail': $fail? :: $fail?
17 + :keyword for 'end': $end? :: $end
18 + :conditional depth:? :conditional depth: |
19 + | :keyword for 'fail': $fail? :: $fail
20 + :keyword for 'end': $end? :: $end
21 + :conditional depth: |
22 + | :keyword for 'fail': $fail? :: $fail
23 + :keyword for 'end': $end? :: $end |
24 +
25 + | :keyword for 'fail': $fail? :: $fail?
26 + :: $1 |
27 + | :keyword for 'fail': $fail? :: $fail?
28 + :: $1 $2 |
29 + | :keyword for 'fail': $fail? :: $fail?
30 + :: $1 $2 $3 |
31 + | :keyword for 'fail': $fail? :: $fail?
32 + :: $1 $2 $3 $4 |
33 + | :keyword for 'fail': $fail? :: $fail?
34 + :: $1 $2 $3 $4 $5 |
35 + | :keyword for 'fail': $fail? :: $fail?
36 + :: $1 $2 $3 $4 $5 $6 |
37 + | :keyword for 'fail': $fail? :: $fail?
38 + :: $1 $2 $3 $4 $5 $6 $7 |
39 + | :keyword for 'fail': $fail? :: $fail?
40 + :: $1 $2 $3 $4 $5 $6 $7 $8 |
41 + | :keyword for 'fail': $fail? :: $fail?
42 + :: $1 $2 $3 $4 $5 $6 $7 $8 $9 |
43 + | :keyword for 'fail': $fail? :: $fail?
44 + :: $1 $2 $3 $4 $5 $6 $7 $8 $9 $10 |
45 + | :keyword for 'fail': $fail? :: $fail |
46 +
47 + | :keyword for 'else': $else? :: $else?
48 + :keyword for 'if': $if? :: $if |
49 + :conditional depth:
50 +
51 + | :keyword for 'else': $else? :: $else?
52 + :keyword for 'end': $end? :: $end
53 + :conditional depth:? :conditional depth: |
54 +
55 + | :keyword for 'else': $else? :: $else
56 + :keyword for 'end': $end? :: $end
57 + :conditional depth: |
58 +
59 + | :keyword for 'else': $else? :: $else
60 + :keyword for 'end': $end? :: $end |
61 +
62 + | :keyword for 'else': $else? :: $else?
63 + :: $1 |
64 + | :keyword for 'else': $else? :: $else?
65 + :: $1 $2 |
66 + | :keyword for 'else': $else? :: $else?
67 + :: $1 $2 $3 |
68 + | :keyword for 'else': $else? :: $else?
69 + :: $1 $2 $3 $4 |
70 + | :keyword for 'else': $else? :: $else?
71 + :: $1 $2 $3 $4 $5 |
72 + | :keyword for 'else': $else? :: $else?
73 + :: $1 $2 $3 $4 $5 $6 |
74 + | :keyword for 'else': $else? :: $else?
75 + :: $1 $2 $3 $4 $5 $6 $7 |
76 + | :keyword for 'else': $else? :: $else?
77 + :: $1 $2 $3 $4 $5 $6 $7 $8 |
78 + | :keyword for 'else': $else? :: $else?
79 + :: $1 $2 $3 $4 $5 $6 $7 $8 $9 |
80 + | :keyword for 'else': $else? :: $else?
81 + :: $1 $2 $3 $4 $5 $6 $7 $8 $9 $10 |
82 + | :keyword for 'else': $else? :: $else |
83 +
84 + |:keyword for 'if': $if? :: $if|
85 + |:keyword for 'end': $end? :: $end|

capitalex's Avatar capitalex revised this gist 1748901780. Go to revision

1 file changed, 97 insertions

fizzbuzz.nv(file created)

@@ -0,0 +1,97 @@
1 + || :: fizzbuzz :n: 1 :max: 100
2 +
3 + |:: fizzbuzz :n: $n? :max: $m?|
4 + :: as long as $n is not greater than $m :: then
5 + :: $n is a multiple of 3 :: then
6 + :: it's a fizz number
7 + :: $n is a multiple of 5 :: then
8 + :: it's a buzz number
9 + :: end
10 + :: else :: $n is a multiple of 5 :: then
11 + :: it's a buzz number
12 + :: $n is a multiple of 3 :: then
13 + :: it's a buzz number
14 + :: end
15 + :: end
16 + :: show the number's fizzbuzziness
17 + :: next n :: fizzbuzz
18 + :: end
19 +
20 + |:: as long as $n is not greater than $m :@math: greater|
21 + :: false
22 + |:: as long as $n is not greater than $m :@math: $not-greater|
23 + |:: as long as $n is not greater than $m?|
24 + :@math: compare $n $m
25 +
26 + |:: $n is a multiple of $m :@math: 0|
27 + |:: $n is a multiple of $m :@math: $nope|
28 + :: false
29 + |:: $n is a multiple of $m?|
30 + :@math: modulo $n $m
31 +
32 + |:: it's a fizz number| :fizz:
33 + |:: it's a buzz number| :buzz:
34 +
35 +
36 + |:: show the number's fizzbuzziness|
37 + :: push new line
38 + :: push buzz
39 + :: push fizz
40 + :: show the fizzbuzziness
41 +
42 + |:: push new line|
43 + :message: "\n"
44 +
45 + |:: push buzz :buzz:|
46 + :message: "buzz"
47 + |:: push buzz|
48 +
49 + |:: push fizz :fizz:|
50 + :message: "fizz"
51 + |:: push fizz|
52 +
53 + |:: show the fizzbuzziness :n: $n? :message: "\n"|
54 + :: print (formatted)
55 + :message: "{%d}\n"
56 + :arguments: $n :arguments:
57 +
58 + |:: show the fizzbuzziness|
59 + :: print (formatted)
60 +
61 + |:: next n :@math: $n|
62 + :n: $n
63 + |:: next n? :n: $n|
64 + :@math: add $n 1
65 +
66 + |:: print (formatted)? :message: "{%d}" :arguments:|
67 + |:: print (formatted)? :message: "{%d}" :arguments: $n|
68 + :message: "{}"
69 + :: collect digits of $n
70 +
71 + |:: collect digits of $n :div: 0 :mod: $mod|
72 + :: add digit to message $mod
73 + |:: collect digits of $n :div: $div :mod: $mod|
74 + :: add digit to message $mod
75 + :: collect digits of $div
76 + |:: collect digits of $n?|
77 + :: divide by 10 :@math: divide $n 10
78 + :: mod by 10 :@math: modulo $n 10
79 +
80 + |:: divide by 10 :@math: $div|
81 + :div: $div
82 + |:: mod by 10 :@math: $mod|
83 + :mod: $mod
84 +
85 + |:: add digit to message $n :@math: $char|
86 + :message: $char
87 + |:: add digit to message $n?|
88 + :@math: add 48 $n
89 +
90 + |:: print (formatted)? :message: "{}" :arguments: |
91 + |:: print (formatted)? :message: "{}"? :arguments: $char|
92 + :@stdio: write $char
93 + |:: print (formatted)? :message: "\n"|
94 + :@stdio: write 10
95 + |:: print (formatted)? :message: $char|
96 + :@stdio: write $char
97 + |:: print (formatted)|
Newer Older