aboutsummaryrefslogtreecommitdiff
path: root/docs/METAPROGRAMMING.md
diff options
context:
space:
mode:
Diffstat (limited to 'docs/METAPROGRAMMING.md')
-rw-r--r--docs/METAPROGRAMMING.md12
1 files changed, 6 insertions, 6 deletions
diff --git a/docs/METAPROGRAMMING.md b/docs/METAPROGRAMMING.md
index b6a4165..a8675b2 100644
--- a/docs/METAPROGRAMMING.md
+++ b/docs/METAPROGRAMMING.md
@@ -10,7 +10,7 @@ Macros may not change Puck's syntax: the syntax is flexible enough. Code is synt
**function scope**: takes the arguments within or following a function call
```puck
macro print(params: varargs) =
- for param in params:
+ for param in params do
result.add(quote(stdout.write(`params`.str)))
print(1, 2, 3, 4)
@@ -21,7 +21,7 @@ print "hello", " ", "world", "!"
```puck
macro my_macro(body)
-my_macro:
+my_macro
1
2
3
@@ -31,7 +31,7 @@ my_macro:
**operator scope**: takes one or two parameters either as a postfix (one parameter) or an infix (two parameters) operator
```puck
macro +=(a, b) =
- quote:
+ quote
`a` = `a` + `b`
a += b
@@ -47,10 +47,10 @@ As macros operate at compile time, they may not inspect the *values* that their
```puck
macro ?[T, E](self: Result[T, E]) =
- quote:
+ quote
match self
- of Okay(x): x
- of Error(e): return Error(e)
+ of Okay(x) then x
+ of Error(e) then return Error(e)
func meow: Result[bool, ref Err] =
let a = stdin.get()?