diff options
| author | Andrey Orst <andreyorst@gmail.com> | 2020-11-01 17:49:46 +0300 |
|---|---|---|
| committer | Andrey Orst <andreyorst@gmail.com> | 2020-11-01 17:50:08 +0300 |
| commit | 62eec219d6697e1fd6347c07f27655b19d7a2ba7 (patch) | |
| tree | 069a2f36a13fcca67835acd49e9ed92ac1d30b71 /core.fnl | |
| parent | a6e563f7a1cdae883825bd8079ee38eceee2cb49 (diff) | |
fix(core): more robust version of concat
Diffstat (limited to 'core.fnl')
| -rw-r--r-- | core.fnl | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -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))) |