aboutsummaryrefslogtreecommitdiff
path: root/examples/tutorial.nom
diff options
context:
space:
mode:
authorBruce Hill <bitbucket@bruce-hill.com>2017-09-21 02:33:04 -0700
committerBruce Hill <bitbucket@bruce-hill.com>2017-09-21 02:33:04 -0700
commit5f2db8da0e99fca282265b232330f3f432b94373 (patch)
tree5c27a1f958b55a15b0e35139165c885574d4fa3a /examples/tutorial.nom
parent371548150618d5b3501f388972077b5d035f7d8a (diff)
Everything fixed up and some reduced lua codespew too!
Diffstat (limited to 'examples/tutorial.nom')
-rw-r--r--examples/tutorial.nom9
1 files changed, 6 insertions, 3 deletions
diff --git a/examples/tutorial.nom b/examples/tutorial.nom
index 306a0af..8739348 100644
--- a/examples/tutorial.nom
+++ b/examples/tutorial.nom
@@ -234,6 +234,7 @@ sing 9 bottles of beer
say (5 + (4 * (- (1 + (6 + 2)))))
# For convenience, +,*,"and", and "or" have been hand defined to work with up to 4 operands:
1 + 2 + 3 + 4
+say "Done with math."
1 * 2 * 3 * 4
1 and 2 and 3 and 4
1 or 2 or 3 or 4
@@ -245,6 +246,8 @@ any of [0,0,0,0,1,0,0]
# And 3-operand chained inequality comparisons have been defined:
1 < 2 <= 3
+say "Done with math."
+
# Macros:
# The "lua block %" and "lua expr %" macros can be used to write raw lua code:
@@ -264,8 +267,8 @@ say ".."|The square root of 2 is \square root of 2\
# Macros can be defined as functions that take unprocessed syntax trees and return lua code
# "macro block %" is for defining macros that produce blocks of code, not values
macro block [unless %condition %body] =: ".."
- |if not (\%condition as lua expr\) then
- | \(lua expr "vars.body.value") as lua block\
+ |if not (\%condition as lua\) then
+ | \(lua expr "vars.body.value") as lua\
|end
unless (1 > 10):
@@ -274,6 +277,6 @@ unless (1 > 10):
# and "macro %" is for defining macros that produce an expression
macro [%value as a boolean] =: ".."
- |(not not (\%value as lua expr\))
+ |(not not (\%value as lua\))
macro [yep] =: "true"