summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.org6
-rw-r--r--macros/core.fnl4
-rw-r--r--macros/fn.fnl4
3 files changed, 9 insertions, 5 deletions
diff --git a/README.org b/README.org
index 19c2849..7949fb2 100644
--- a/README.org
+++ b/README.org
@@ -39,8 +39,12 @@ Capable of producing multi-arity functions:
;; [-10 -9 -8 -7 -6 -5 -4 -3 -2 -1]
(range 0 1 0.2)
;; [0.0 0.2 0.4 0.6 0.8]
+#+end_src
+
+Both variants support up to one arity with =& more=:
+
+#+begin_src fennel
- ;; both variants support up to one arity with & more:
(fn* vec [& xs] xs)
(vec 1 2 3)
diff --git a/macros/core.fnl b/macros/core.fnl
index 9b01b70..b47f38b 100644
--- a/macros/core.fnl
+++ b/macros/core.fnl
@@ -8,7 +8,7 @@
(fn* if-let
([bindings then]
- (if-let bindings then 'nil))
+ (if-let bindings then nil))
([bindings then else]
(check-bindings bindings)
(let [[form test] bindings]
@@ -29,7 +29,7 @@
(fn* if-some
([bindings then]
- (if-some bindings then 'nil))
+ (if-some bindings then nil))
([bindings then else]
(check-bindings bindings)
(let [[form test] bindings]
diff --git a/macros/fn.fnl b/macros/fn.fnl
index 7a3b027..cada324 100644
--- a/macros/fn.fnl
+++ b/macros/fn.fnl
@@ -74,7 +74,7 @@
;; For more info check `gen-arity' documentation.
(let [[args & body] args
(arity body amp) (gen-arity [args (_unpack body)])]
- `(let [len# (length [...])]
+ `(let [len# (select :# ...)]
,(arity-dispatcher
'len#
(if amp {} {arity body})
@@ -94,7 +94,7 @@
(assert-compile (<= (length bodies&) 1)
"fn* must have only one arity with `&':"
(. bodies& (length bodies&)))
- `(let [len# (length [...])]
+ `(let [len# (select :# ...)]
,(arity-dispatcher
'len#
bodies