(reduce #(conj %1 (%2 (last %1))) [1] [inc inc even?])
[1 2 3 false]
(map #(conj {} %) {:a 1, :b {:c 3, :d 4}})
({:a 1} {:b {:c 3, :d 4}})
(:foo (meta (conj (with-meta '(1 2 3) {:foo "bar"}) 4)))
"bar"
(reduce #(conj %1 (+ (last %1) %2)) [3] [11 8])
[3 14 22]
(let [a 2 b [1]] (if a (conj b a) b))
[1 2]
(reduce (fn [result entry] (if (even? (count entry)) (conj result entry) (conj (butlast result) (concat (last result) entry)))) [] [[1 2] [3 4 5] [6 7]])
([6 7] (1 2 3 4 5))
(defn rows [[full pending] word] (if (> (apply + (count word) (map count pending)) 35) [(conj full pending) [word]] [full (conj pending word)]))
#'user/rows
(reduce (fn [[left right] item] (if (odd? item) [(conj left item) right] [left (conj right item)])) [[] []] '(1 2 3 4 5 6))
[[1 3 5] [2 4 6]]
(let [v []] (for [item [1 2 3]] (conj v item)) v)
[]
(meta (pop (conj (with-meta '(1 2 3) {:my :meta}) 4)))
{:my :meta}
(swap! (atom {:numbers #{0}}) update-in [:blubber] conj 1 2 3)
{:blubber (3 2 1), :numbers #{0}}
(doseq [x (reductions conj [] '(a b c d))] (println x))
nil
"[]\n[a]\n[a b]\n[a b c]\n[a b c d]\n"
(apply conj [3] 3 1 3 4 4 [1 2 3])
[3 3 1 3 4 4 1 2 3]
(conj {:a 1, :b 2, :c 3} {:from 'x, :to 'y})
{:a 1, :b 2, :c 3, :from x, :to y}
(type (conj [1 2 3 4 5 6 7 8] 1))
clojure.lang.PersistentVector
(let [x #{} y (conj x "foo")] (= x y))
false
(reductions (fn [v n] (conj v n)) [] [1 2 3 4])
([] [1] [1 2] [1 2 3] [1 2 3 4])
(apply conj [] '({:a a, :b b} {:c c, :d d}))
[{:a a, :b b} {:c c, :d d}]
((comp :out reduce) (fn [blob token] (if (= :end token) (update-in (update-in blob [:out] conj (conj (:scratch blob) token)) [:scratch] (constantly [])) (update-in blob [:scratch] conj token))) {:out [], :scratch []} [:start 1 2 3 :end :start 5 6 7 :end])
[[:start 1 2 3 :end] [:start 5 6 7 :end]]
(let [base [1 2 3 5 6 8]] (reduce (fn [stack [a b]] (if (= (- a b) -1) (update stack (dec (count stack)) conj a) (conj (update stack (dec (count stack)) conj a) []))) [[]] (partition 2 1 base)))
[[1 2 3] [5 6] []]
(reduce (fn [blob token] (if (= :end token) (update-in (update-in blob [:out] conj (conj (:scratch blob) token)) [:tmp] (constantly [])) (update-in blob [:scratch] conj token))) {:out [], :scratch []} [:start 1 2 3 :end :start 5 6 7 :end])
{:out [[:start 1 2 3 :end] [:start 1 2 3 :start 5 6 7 :end]], :scratch [:start 1 2 3 :start 5 6 7], :tmp []}
(reduce #(if (even? %2) (conj %1 %2) %1) [] (range 10))
[0 2 4 6 8]
((fn [& t] (conj t [1 2])) 1 2 3 4)
([1 2] 1 2 3 4)
(reduce-kv #(update-in %1 [%2] conj %3) {} [[:a 1] [:a 2]])
{0 ([:a 1]), 1 ([:a 2])}
(reduce conj (map (fn [k] {k (name k)}) [:a :b :c]))
{:a "a", :b "b", :c "c"}
(let [mem-conj (memoize conj)] [(mem-conj '(1) 2) (mem-conj [1] 2)])
[(2 1) (2 1)]
(let [xs (range 5)] (clojure.string/join " " (reduce conj xs xs)))
"4 3 2 1 0 0 1 2 3 4"
(let [base [1 2 3 5 6 8]] (reduce (fn [stack [a b]] (if (= (- a b) -1) (update stack (dec (count stack)) conj a) (conj (update stack (dec (count stack)) conj a) [b]))) [[]] (partition 2 1 base)))
[[1 2 3] [5 5 6] [8]]
(reduce (fn [{:keys [accum result]} x] {:accum (conj accum x), :result (conj result (accum x))}) {:accum #{}, :result []} [:a :b :b :c :d :c])
{:accum #{:a :b :c :d}, :result [nil nil :b nil nil :c]}
(let [s (list 1 2 3)] (identical? (conj (rest s) 1) s))
false
(let [x (list 2) y (conj x 1)] (identical? x (rest y)))
true
(reduce #(if (= (last %1) %2) %1 (conj %1 %2)) [] "Heeeeeeeeeeeeeeeeeeeello")
[\H \e \l \o]
(reduce (fn [acc x] (conj acc (vector x))) [] [1 2 3 4])
[[1] [2] [3] [4]]
(reduce #(if (even? %2) (conj %1 (inc %2)) %1) [] (range 10))
[1 3 5 7 9]
(reduce conj #{} '(a b a c d g g w))
#{a b c d g w}
(reduce (fn [accumulator item] (conj accumulator item)) '() [1 2 3 4])
(4 3 2 1)
(defn cond-conj [s pred x] (cond-> s (pred s x) (conj x)))
#'user/cond-conj
(reduce conj #{} (for [i (range 10) j (range 10)] [i j]))
#{[8 8] [7 6] [8 7] [9 8] [7 1] [8 9] [4 3] [2 2] [0 0] [3 9] [7 7] [2 8] [1 0] [8 4] [2 3] [2 5] [7 2] [6 7] [7 4] [8 3] [0 6] [3 3] [5 4] [1 1] [6 3] [0 5] [3 4] [7 3] [8 6] [4 2] [7 8] [3 0] [9 0] [6 6] [9 6] [1 9] [5 3] [9 9] [9 3] [4 7] [4 9] [2 9] [6 5] [0 9] [8 0] [4 1] [5 2] [4 6] [1 4] [5 7] [8 2] [1 3] [4 8] [1 5] [1 8] [1 7] [6 4] [8 1] [0 3] [5 1] [6 1] [5 6] [5 8] [8 5] [0 7] [6 8] [5...
(-> (update-in {} [:first] (fnil inc 0)) (update-in [:second] (fnil conj []) :value))
{:first 1, :second [:value]}
(let [chores [1 2 3]] (conj (subvec chores 1) (first chores)))
[2 3 1]
((juxt merge conj) {:a 1} {:b 2} {:a 3, :c 5})
[{:a 3, :b 2, :c 5} {:a 3, :b 2, :c 5}]
(swap! (atom {}) update-in [:a] (fn [val] ((fnil conj #{}) val :a)))
{:a #{:a}}
(->> [1 2 3] (reductions conj []) rest (map (partial apply +)))
(1 3 6)
(let [start [1 2 3]] (identical? start (pop (conj start 4))))
false
(reduce conj (sorted-map) {:a 1, :b 2, :c 3, :d 4})
{:a 1, :b 2, :c 3, :d 4}
(conj {:a 1, :c 3, :b 42} {:b 2, :d 4})
{:a 1, :b 2, :c 3, :d 4}
(= [1 2 3 4] (conj '(2 3 4) 1))
true
((fn [fname & args] (conj () args (read-string fname) 'apply)) "inc" 2)
(apply inc (2))
(let [foo #(partial conj (empty %))] ((foo [1 2 3]) 4))
[4]
(let [v []] (do (for [item [1 2 3]] (conj v item)) v))
[]