; Adds a variable number of elements to a vector ('& xs' in the function definition means to accept a variable number of parameters). Note with vectors, item is added to the end
(conj [:a :b :c] :d :e :f :g)
=> [:a :b :c :d :e :f :g]
; Adds items to a list. Note items are added to front of list and end up in reverse order because each individual item is added to the front of the list sequentially (conj '(1 2 3) :a :b :c) => (:c :b :a 1 2 3)
; Adds a list to a vector. Note list remains intact and is added at the end of the vector as a list within the vector. (conj [:a :b :c] '(1 2 3 4)) => [:a :b :c (1 2 3 4)]
(defmulti conj
"Returns a new collection resulting from adding all xs to coll."
{:arglists '([coll & xs])}
(fn [coll & xs] (type coll)))
Comments top
No comments for conj. Log in to add a comment.