From 62eec219d6697e1fd6347c07f27655b19d7a2ba7 Mon Sep 17 00:00:00 2001 From: Andrey Orst Date: Sun, 1 Nov 2020 17:49:46 +0300 Subject: fix(core): more robust version of concat --- core.fnl | 8 ++++++-- 1 file 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))) -- cgit v1.2.3