summaryrefslogtreecommitdiff
path: root/dot_config/nvim/fnl/toast/table.fnl
blob: a294b142df155c01df8491a7dee9a4c674c55174 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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}