aboutsummaryrefslogtreecommitdiffstats
path: root/docs/reference/03-3_functions.md
diff options
context:
space:
mode:
authors-ol <s+removethis@s-ol.nu>2025-09-14 10:12:13 +0000
committers-ol <s+removethis@s-ol.nu>2025-09-14 15:36:21 +0000
commit06c239e4f44849a3e4c8317194caacbcc47fc2d4 (patch)
tree491c8c5f9e3ad4351aa55951a0d7c70cd8686087 /docs/reference/03-3_functions.md
parentexpose Tag to Ops (diff)
downloadalive-06c239e4f44849a3e4c8317194caacbcc47fc2d4.tar.gz
alive-06c239e4f44849a3e4c8317194caacbcc47fc2d4.zip
de/fn, loop parameter lists use square brackets
Diffstat (limited to 'docs/reference/03-3_functions.md')
-rw-r--r--docs/reference/03-3_functions.md8
1 files changed, 3 insertions, 5 deletions
diff --git a/docs/reference/03-3_functions.md b/docs/reference/03-3_functions.md
index 6715eb7..4fc32ba 100644
--- a/docs/reference/03-3_functions.md
+++ b/docs/reference/03-3_functions.md
@@ -5,8 +5,7 @@ code, amongst other things:
(import* math)
(def add-and-trace
- (fn
- (a b)
+ (fn [a b]
(trace (+ a b))))
(add-and-trace 1 2)
@@ -29,8 +28,7 @@ example is equivalent to the following:
(import* math)
(def add-and-trace
- (fn
- (a b)
+ (fn [a b]
(trace (+ a b)))
(do
@@ -53,5 +51,5 @@ name, so there is the `defn` shorthand, which combines the `def` and `fn`
builtins into a single expression. Compare this equivalent definition of the
`add-and-trace` function:
- (defn add-and-trace (a b)
+ (defn add-and-trace [a b]
(trace (+ a b)))