diff options
| author | 2024-07-24 19:19:26 +0200 | |
|---|---|---|
| committer | 2024-07-24 19:19:26 +0200 | |
| commit | 01586921b3d5f2ac1ccf8196d3ad9b4b3ddd31f3 (patch) | |
| tree | d740ac5e8943e48ee4132efc4633051d6cdf1d48 /dot_config/nvim/fnl/toast/table.fnl | |
| parent | nvim: ignore lazy-lock.json (diff) | |
nvim: rewrite config in fennel
One file isn't done, and there's also the question of ftplugin and co.
One step at a time though, eh?
Diffstat (limited to '')
| -rw-r--r-- | dot_config/nvim/fnl/toast/table.fnl | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/dot_config/nvim/fnl/toast/table.fnl b/dot_config/nvim/fnl/toast/table.fnl new file mode 100644 index 0000000..a294b14 --- /dev/null +++ b/dot_config/nvim/fnl/toast/table.fnl @@ -0,0 +1,15 @@ +(fn from-pairs [t ?mut] + "Convert a list of [k v] pairs to a table. + If an initial table ?mut is provided, it will be mutated and returned." + (let [out (or ?mut {})] + (each [_ [k v] (ipairs t)] + (tset out k v)) + out)) + +(fn insert [t ...] + "Like table.insert, but returns the mutated table." + (table.insert t ...) + t) + +{: from-pairs + : insert} |
