Última actividad 1749245592

bottles-of-beer.nv Sin formato Playground
1|| :keyword for 'if': say
2 :keyword for 'else': otherwise-say
3
4|| :: 99 bottles of beer
5
6|:: $n bottles of beer|
7:: $n bottles of beer on the wall!
8:: $n bottles of beer!
9:: You take one down, pass it around!
10:: when $n is 1 :: say
11:: No more bottles of beer on the wall!
12:: otherwise-say
13:: $n - 1 bottles of beer on the wall!
14:: $n - 1 bottles of beer
15:: end
16
17|:: 1 bottles of beer on the wall!|
18 :: print (formatted)
19 :message: "1 bottle of beer on the wall!\n"
20|:: $n bottles of beer on the wall!|
21 :: print (formatted)
22 :message: "{%d} bottles of beer on the wall!\n"
23 :arguments: $n :arguments
24
25|:: 1 bottles of beer!|
26 :: print (formatted)
27 :message: "1 bottle of beer!\n"
28|:: $n bottles of beer!|
29 :: print (formatted)
30 :message: "{%d} bottles of beer!\n"
31 :arguments: $n :arguments
32
33|:: You take one down, pass it around!|
34 :: print (formatted)
35 :message: "You take one down, pass it around!\n"
36
37|:: when $n is $n|
38|:: when $n is $m| :: false
39
40|:: $_ - 1 bottles of beer on the wall! :@math: 1|
41 :: print (formatted)
42 :message: "1 bottle of beer on the wall!\n\n"
43|:: $_ - 1 bottles of beer on the wall! :@math: $n|
44 :: print (formatted)
45 :message: "{%d} bottle of beer on the wall!\n\n"
46 :arguments: $n :arguments:
47|:: $n - 1 bottles of beer on the wall!?|
48 :@math: subtract $n 1
49
50|:: $_ - 1 bottles of beer :@math: $n| :: $n bottles of beer
51|:: $n - 1 bottles of beer?| :@math: subtract $n 1
52
53|:: No more bottles of beer on the wall!|
54 :: print (formatted)
55 :message: "No more bottles of beer on the wall!\n"
conditions.nv Sin formato Playground
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 :keyword for 'fail': $fail?| :: $fail :conditional depth:
48|:keyword for 'if': $if? :: $if|
49|:keyword for 'end': $end? :: $end|
50
print-format.nv Sin formato Playground
1|:: print (formatted)? :message: "{%d}" :arguments:|
2|:: print (formatted)? :message: "{%d}" :arguments: $n|
3 :message: "{}"
4 :: collect digits of $n
5
6|:: collect digits of $n :div: 0 :mod: $mod|
7 :: add digit to message $mod
8|:: collect digits of $n :div: $div :mod: $mod|
9 :: add digit to message $mod
10 :: collect digits of $div
11|:: collect digits of $n?|
12 :: divide by 10 :@math: divide $n 10
13 :: mod by 10 :@math: modulo $n 10
14
15|:: divide by 10 :@math: $div|
16 :div: $div
17|:: mod by 10 :@math: $mod|
18 :mod: $mod
19
20|:: add digit to message $n :@math: $char|
21 :message: $char
22|:: add digit to message $n?|
23 :@math: add 48 $n
24
25
26|:: print (formatted)? :message: "{}" :arguments: |
27|:: print (formatted)? :message: "{}"? :arguments: $char|
28 :@stdio: write $char
29|:: print (formatted)? :message: "\n"|
30 :@stdio: write 10
31|:: print (formatted)? :message: $char|
32 :@stdio: write $char
33|:: print (formatted)|