conj

known as "conjoin"
functionsince v0.0-927 clojure.core/conjEdit
(conj)
(conj coll)
(conj coll x)
(conj coll x & xs)

Details:

conj(oin)

Returns a new collection with the xs "added" to coll.

The "addition" may happen at different "places" depending on the collection type.

(conj nil item) returns (item).


Examples:

Append a vector:

(conj [1 2 3] 4)
;;=> [1 2 3 4]

Prepend a list:

(conj (list 1 2 3) 0)
;;=> (0 1 2 3)

Prepend a sequence:

(def x (range 1 4))
;;=> (1 2 3)

(conj x 0)
;;=> (0 1 2 3)

Add to set:

(conj #{"a" "b" "c"} "d")
;;=> #{"a" "b" "c" "d"}

See Also:


Source docstring:
conj[oin]. Returns a new collection with the xs
'added'. (conj nil item) returns (item).
(conj coll) returns coll. (conj) returns [].
The 'addition' may happen at different 'places' depending
on the concrete type.
Source code @ clojurescript:src/main/cljs/cljs/core.cljs
(defn conj
  ([] [])
  ([coll] coll)
  ([coll x]
    (if-not (nil? coll)
      (-conj coll x)
      (list x)))
  ([coll x & xs]
    (if xs
      (recur (conj coll x) (first xs) (next xs))
      (conj coll x))))