JanetDocsPlaygroundI'm feeling luckyGitHub sign in

array/concat



    cfunction

    (array/concat arr & parts)

    Concatenates a variable number of arrays (and tuples) into the first
    argument which must be an array. If any of the parts are arrays or
    tuples, their elements will be inserted into the array. Otherwise,
    each part in parts will be appended to arr in order. Return the
    modified array arr.


2 examplesSign in to add an example
Loading...
(def a @[1 2])
(def b @[1 2])
(= a b)  # => false

(def a @[1 2])
(def b (array/concat a 3))
a        # => @[1 2 3]
b        # => @[1 2 3]
(= a b)  # => true
cellularmitosisPlayground
(def a @[1 2])
(array/concat a 3 [4 5] @[6 7] [] @[] 8)
a  # => @[1 2 3 4 5 6 7 8]
cellularmitosisPlayground