summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrey Orst <andreyorst@gmail.com>2020-11-01 17:49:46 +0300
committerAndrey Orst <andreyorst@gmail.com>2020-11-01 17:50:08 +0300
commit62eec219d6697e1fd6347c07f27655b19d7a2ba7 (patch)
tree069a2f36a13fcca67835acd49e9ed92ac1d30b71
parenta6e563f7a1cdae883825bd8079ee38eceee2cb49 (diff)
fix(core): more robust version of concat
-rw-r--r--core.fnl8
1 files changed, 6 insertions, 2 deletions
diff --git a/core.fnl b/core.fnl
index 31708ff..26cedcb 100644
--- a/core.fnl
+++ b/core.fnl
@@ -3,7 +3,7 @@
(local insert table.insert)
(local unpack (or table.unpack _G.unpack))
(import-macros {: fn* : fn&} :macros.fn)
-(import-macros {: when-some : if-some : when-let : into} :macros.core)
+(import-macros {: when-some : if-some : when-let} :macros.core)
(fn* core.apply
"Apply `f' to the argument list formed by prepending intervening
@@ -193,7 +193,11 @@ If `tbl' is sequential table, returns its shallow copy."
"Concatenate tables."
([] nil)
([x] (safe-seq x))
- ([x y] (into (safe-seq x) (safe-seq y)))
+ ([x y] (let [to (safe-seq x)
+ from (safe-seq y)]
+ (each [_ v (ipairs from)]
+ (insert to v))
+ to))
([x y & xs]
(apply concat (concat x y) xs)))