diff options
| author | 2024-08-07 21:51:15 +0200 | |
|---|---|---|
| committer | 2024-08-07 21:51:15 +0200 | |
| commit | 23d6644dbe76e22d8558657bfede7b5d471d6383 (patch) | |
| tree | 6ef0b96be5a3e840548d125a208bca4d262d8827 /dot_config/nvim/fnl/toast/table.fnl | |
| parent | nvim: move mini plugin into a single file (diff) | |
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.
Diffstat (limited to '')
| -rw-r--r-- | dot_config/nvim/fnl/toast/table.fnl | 12 |
1 files changed, 11 insertions, 1 deletions
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} |
