JanetDocsPlaygroundI'm feeling luckyGitHub sign in

table



    cfunction

    (table & kvs)

    Creates a new table from a variadic number of keys and values. kvs is
    a sequence k1, v1, k2, v2, k3, v3, ... If kvs has an odd number of
    elements, an error will be thrown. Returns the new table.


3 examplesSign in to add an example
Loading...
(def kvpairs [[:x 1] [:y 2]])

(table ;(flatten kvpairs)) => @{:x 1 :y 2}
yumaikasPlayground
(table ;(kvs (struct :a 1 :b 2)))
# => @{:a 1 :b 2}
sogaiuPlayground
(table ;[:a 1 :b 2 :c 3])
# => @{:a 1 :b 2 :c 3}
sogaiuPlayground