diff options
| author | Bruce Hill <bitbucket@bruce-hill.com> | 2017-10-02 19:00:58 -0700 |
|---|---|---|
| committer | Bruce Hill <bitbucket@bruce-hill.com> | 2017-10-02 19:00:58 -0700 |
| commit | 63ed265157de8ff91dee606b0e61e52214a4083b (patch) | |
| tree | 0b9aa6e920d8ea9a4938a59a0e7b39355b108150 /examples/sample_code.nom | |
| parent | dcd3391b36c7accc194cfdc8654db085c9bc820e (diff) | |
More progress towards making everything work.
Diffstat (limited to 'examples/sample_code.nom')
| -rw-r--r-- | examples/sample_code.nom | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/examples/sample_code.nom b/examples/sample_code.nom index fe73ec7..1e1ccc6 100644 --- a/examples/sample_code.nom +++ b/examples/sample_code.nom @@ -34,7 +34,7 @@ say ".." |^and trailing spaces | -say ".."|Longstrings have interpolation: \1 + 2\ <- like that +say "Strings have interpolation: \(1 + 2) <- like that" rule [doublefart] =: # this farts twice say "poot" @@ -76,9 +76,9 @@ say both if 1: yes ..else: no -if 1 (:yes) else (:no) +if 1 {yes} else {no} -say (do: return 5) +say (do {return 5}) # Some variables rule [do %one also %two] =: @@ -88,7 +88,7 @@ rule [do %one also %two] =: do: say "one liner" ..also: say "another one liner" -say (do: return "wow") +say (do {return "wow"}) say (1 + (-(2 * 3))) @@ -97,21 +97,21 @@ say (..) 3 * 4 when: - ? %x == 1: + * (%x == 1): say "one" - ? %x == 2: + * (%x == 2): say "two" - ? %x: + * %x: say "nonzero" - ?: + * else: say "???" -when %x: - == 1: +when %x == ?: + * 1: say "one" - == 2: + * 2: say "two" - ==: + * else: say "???" @@ -134,7 +134,7 @@ rule [%n bottles] =: lua block ".." |do | print("running raw lua code...") - | for i=\%n\,1,-1 do + | for i=\(%n),1,-1 do | print(tostring(i).." bottles of beer on the wall. Take one down, pass it around,") | end | print("no more bottles of beer on the wall.") @@ -143,9 +143,9 @@ rule [%n bottles] =: 9 bottles rule [dumsum %nums] =: - %sum =: 0 + %sum = 0 for %n in %nums: - %sum +=: %n + %sum += %n return %sum say (dumsum [1,2,3]) |
