diff options
| author | Andrey Orst <andreyorst@gmail.com> | 2020-10-26 20:57:22 +0300 |
|---|---|---|
| committer | Andrey Orst <andreyorst@gmail.com> | 2020-10-26 20:59:07 +0300 |
| commit | 1d2bba82b09710b0dc6ca4e1a515763088b3fbf5 (patch) | |
| tree | 9454e1ffcb40d33dff52ba83b88296686b28d2f6 /macros/core.fnl | |
| parent | cab42d9dbb162a6ca399d4d46dc20a5cbf4452ed (diff) | |
feature: refactoring
make some functions private (for coverage.sh)
Separate tests into one test per function (for coverage.sh)
Diffstat (limited to 'macros/core.fnl')
| -rw-r--r-- | macros/core.fnl | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/macros/core.fnl b/macros/core.fnl index bf4dfe8..ed147ed 100644 --- a/macros/core.fnl +++ b/macros/core.fnl @@ -2,7 +2,7 @@ (local unpack (or table.unpack _G.unpack)) (local insert table.insert) -(fn check-bindings [bindings] +(fn -check-bindings [bindings] (and (assert-compile (sequence? bindings) "expected binding table" []) (assert-compile (= (length bindings) 2) "expected exactly two forms in binding vector." bindings))) @@ -10,7 +10,7 @@ ([bindings then] (if-let bindings then nil)) ([bindings then else] - (check-bindings bindings) + (-check-bindings bindings) (let [[form test] bindings] `(let [tmp# ,test] (if tmp# @@ -20,7 +20,7 @@ (fn* when-let [bindings & body] - (check-bindings bindings) + (-check-bindings bindings) (let [[form test] bindings] `(let [tmp# ,test] (if tmp# @@ -31,7 +31,7 @@ ([bindings then] (if-some bindings then nil)) ([bindings then else] - (check-bindings bindings) + (-check-bindings bindings) (let [[form test] bindings] `(let [tmp# ,test] (if (= tmp# nil) @@ -41,7 +41,7 @@ (fn* when-some [bindings & body] - (check-bindings bindings) + (-check-bindings bindings) (let [[form test] bindings] `(let [tmp# ,test] (if (= tmp# nil) @@ -50,15 +50,15 @@ ,(unpack body)))))) -(fn table-type [tbl] +(fn -table-type [tbl] (if (sequence? tbl) :seq (table? tbl) :table :else)) ;; based on `seq' from `core.fnl' (fn into [to from] - (local to-type (table-type to)) - (local from-type (table-type from)) + (local to-type (-table-type to)) + (local from-type (-table-type from)) `(let [to# ,to from# ,from insert# table.insert |