summaryrefslogtreecommitdiff
path: root/README.org
diff options
context:
space:
mode:
Diffstat (limited to 'README.org')
-rw-r--r--README.org20
1 files changed, 10 insertions, 10 deletions
diff --git a/README.org b/README.org
index 56356c1..53b5ab7 100644
--- a/README.org
+++ b/README.org
@@ -125,12 +125,12 @@ Returns a function of fixed amount of arguments by doing runtime dispatch based
Capable of producing multi-arity functions:
#+begin_src fennel
- (fn* square "square number" [x] (^ x 2))
+ (defn square "square number" [x] (^ x 2))
(square 9) ;; => 81.0
(square 1 2) ;; => error
- (fn* range
+ (defn range
"Returns increasing sequence of numbers from `lower' to `upper'.
If `lower' is not provided, sequence starts from zero.
Accepts optional `step'"
@@ -150,11 +150,11 @@ Capable of producing multi-arity functions:
Both variants support up to one arity with =& more=:
#+begin_src fennel
- (fn* vec [& xs] xs)
+ (defn vec [& xs] xs)
(vec 1 2 3) ;; => [1 2 3]
- (fn* add
+ (defn add
"sum two or more values"
([] 0)
([a] a)
@@ -172,7 +172,7 @@ One extra capability of =fn*= supports the same semantic as =def= regarding name
#+begin_src fennel
(local ns {})
- (fn* ns.plus
+ (defn ns.plus
([] 0)
([x] x)
([x y] (+ x y))
@@ -203,29 +203,29 @@ This is possible because =fn*= separates the namespace part from the function na
See =core.fnl= for more examples.
-** =fn&=
+** =fn+=
Works similarly to Fennel's =fn=, by creating ordinary function without arity semantics, except does the namespace automation like =fn*=, and has the same order of arguments as the latter:
#+begin_src fennel
(local ns {})
;; module & file-local functions
- (fn& ns.double
+ (fn+ ns.double
"double the number"
[x]
(* x 2))
- (fn& ns.triple
+ (fn+ ns.triple
[x]
(* x 3))
;; no namespace, file-local function
- (fn& quadruple
+ (fn+ quadruple
[x]
(* x 4))
;; anonymous file-local function
- (fn& [x] (* x 5))
+ (fn+ [x] (* x 5))
ns
#+end_src