From 23d6644dbe76e22d8558657bfede7b5d471d6383 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chlo=C3=A9=20Vulquin?= Date: Wed, 7 Aug 2024 21:51:15 +0200 Subject: nvim: rework mixed-table macro I didn't like that you couldn't keep mixing and matching, so I made it so you can. In the process, I also implemented even?, odd?, filter, mapcat, flat, and concat. Some of them didn't end up needing to exist, and the entire :toast. namespace does need to be cleaned up. Then again, it's not like I'm selling this like an alternative stdlib. I should really try and port all of clojure.core though, it'd be funny. --- dot_config/nvim/fnl/toast/table.fnl | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'dot_config/nvim/fnl/toast/table.fnl') diff --git a/dot_config/nvim/fnl/toast/table.fnl b/dot_config/nvim/fnl/toast/table.fnl index fe118e8..17934b2 100644 --- a/dot_config/nvim/fnl/toast/table.fnl +++ b/dot_config/nvim/fnl/toast/table.fnl @@ -11,8 +11,18 @@ (table.insert t ...) t) +(fn concat [...] + "Join an arbitrary amount of tables. + Equivalent to a single 'layer' of flat." + (let [out []] + (each [_ xs (ipairs [...])] + (each [_ v (ipairs xs)] + (insert out v))) + out)) + (local unpack (or table.unpack unpack)) {: from-pairs : insert - : unpack} + : unpack + : concat} -- cgit v1.2.3