(reduce #(conj %1 %2) () [1 2 3 4])
(4 3 2 1)
(map (partial conj {:a :b}) [[:c :d] {:c :d}])
({:a :b, :c :d} {:a :b, :c :d})
(last (take 5 (iterate #(conj % (rand-int 10)) [])))
[9 8 6 2]
(conj {:a 1, :b 2} {:b 3, :c 4})
{:a 1, :b 3, :c 4}
(update-in {:myvector [1 2 3]} [:myvector] (fnil conj []) 4)
{:myvector [1 2 3 4]}
(update [:a '(:b :c :d)] 1 conj :aa)
[:a (:aa :b :c :d)]
(conj [1 2 3 4 5 6 7] 8)
[1 2 3 4 5 6 7 8]
(conj [1 2 3 4] 5 6 7 8)
[1 2 3 4 5 6 7 8]
(class (conj (apply array-map (range 100 200)) [300 301]))
clojure.lang.PersistentHashMap
(defn fn1 [n] (lazy-seq (conj (fn1 (inc n)) n)))
#'user/fn1
(update {:name "John", :friends []} :friends #(conj % "Bob"))
{:friends ["Bob"], :name "John"}
(conj {1 2, 3 4} {5 6, 7 8})
{1 2, 3 4, 5 6, 7 8}
(conj {} {:a 1, :b 2} {:c 3, :d 4})
{:a 1, :b 2, :c 3, :d 4}
(let [x #{}] (if (seq x) [] (conj x 10)))
#{10}
(conj [{:a 1, :b 2} {:a 2, :b 3}])
[{:a 1, :b 2} {:a 2, :b 3}]
(reduce #(conj %1 (* 3 %2)) [] (range 10))
[0 3 6 9 12 15 18 21 24 27]
(class (conj (subvec [1 2 3] 0 1) 5))
clojure.lang.APersistentVector$SubVector
(apply merge-with (comp flatten conj) [{:hello [1]} {:hello [2]}])
{:hello (1 2)}
(reduce (fn [[fs ss] [f s]] (list (conj fs f) (conj ss s))) [[] []] [[0 0] [2 4] [4 16] [6 36]])
([0 2 4 6] [0 4 16 36])
(reduce + (reduce #(conj %1 %2) [] (range 3500)))
6123250
(let [xs (range 5)] (pr-str (reduce conj xs xs)))
"(4 3 2 1 0 0 1 2 3 4)"
(conj (take-while #(< % 5) (range 10)) 5)
(5 0 1 2 3 4)
(conj (map #(inc %) [1 2 3]) 9)
(9 2 3 4)
(apply (partial conj [1 2 3]) [7 8 9])
[1 2 3 7 8 9]
(take 3 (drop 1 (iterate #(conj % :a) [])))
([:a] [:a :a] [:a :a :a])
(pop (with-meta (conj [1 2 3] 4) {:my :meta}))
[1 2 3]
(meta (-> [2 3] (with-meta {:foo :bar}) (conj 8)))
{:foo :bar}
(type (conj [1 2 3 4 5 6] 1))
clojure.lang.PersistentVector
(mapv #(reduce conj % (range 5)) [(list) (vector)])
[(4 3 2 1 0) [0 1 2 3 4]]
(conj [0 9] {0 8} {1 8} {2 8})
[0 9 {0 8} {1 8} {2 8}]
(flatten (conj [0 0 0] 1 [2 2 2]))
(0 0 0 1 2 2 2)
(update-in {:foo 12} [:bar :baz] (fnil conj #{}) 42)
{:bar {:baz #{42}}, :foo 12}
(-> (range 10) vec (subvec 0 5) (conj :end))
[0 1 2 3 4 :end]
(apply conj (reduce (fn [[done curr] el] (if (even? el) [(conj done curr) [el]] [done (conj curr el)])) [[] []] [1 2 1 1 2 1 1 1 2 1 1 1 1 2]))
[[1] [2 1 1] [2 1 1 1] [2 1 1 1 1] [2]]
(apply conj (reduce (fn [[done curr] el] (if (odd? el) [(conj done curr) [el]] [done (conj curr el)])) [[] []] [1 2 1 1 2 1 1 1 2 1 1 1 1 2]))
[[] [1 2] [1] [1 2] [1] [1] [1 2] [1] [1] [1] [1 2]]
(let [x #{}] (if-not (seq x) [] (conj x 10)))
[]
(apply (partial conj ['a 'b]) [3 4 5 6])
[a b 3 4 5 6]
(map #(conj % "|") (partition-all 3 (range 10)))
(("|" 0 1 2) ("|" 3 4 5) ("|" 6 7 8) ("|" 9))
(update-in {:wtf {:omg []}} [:wtf :omg] #(conj % "LOL"))
{:wtf {:omg ["LOL"]}}
(conj [0 88 1 88] {0 99, 1 99})
[0 88 1 88 {0 99, 1 99}]
(conj (rest [1 2 3]) (first [1 2 3]))
(1 2 3)
(conj {:foo 4, :faz 38} {:bar 5, :bing 498})
{:bar 5, :bing 498, :faz 38, :foo 4}
(let [set-thing #{1 2 3}] (conj set-thing 5))
#{1 2 3 5}
(map #(conj % 1 2) [[0] '(0)])
([0 1 2] (2 1 0))
(conj {:a 1, :b 2} {1 2} {3 4})
{1 2, 3 4, :a 1, :b 2}
(#(conj (rest %1) %2) [2 3 4] 1)
(1 3 4)
(#(apply conj (reduce (fn [[runs part] i] (if (= i (inc (peek part))) [runs (conj part i)] [(conj runs part) [i]])) [[] [(first %)]] (rest %))) [1 2 3 5 6 8])
[[1 2 3] [5 6] [8]]
(let [f (fn [a b] (if (vector? a) (conj a b) (conj [a] b)))] (merge-with f {1 "a"} {1 "b"} {2 "c"}))
{1 ["a" "b"], 2 "c"}
(reduce #(conj %) [1 2 3 4] '())
[1 2 3 4]
(conj #{1 2 3 4 5} 6 7)
#{1 2 3 4 5 6 7}