(map (juxt inc dec odd? even? pos? neg?) [12 13 14])
([13 11 false true true false] [14 12 true false true false] [15 13 false true true false])
(def triangles (lazy-seq (cons 0 (map + triangles (iterate inc 1)))))
#'user/triangles
(macroexpand '(fn f [x] (lazy-seq (cons x (f (inc x))))))
(fn f [x] (lazy-seq (cons x (f (inc x)))))
(let [a 0 a (inc a) a (* a a)] a)
1
(apply (fn [x y] (+ x y)) (map inc [1 2]))
5
(transduce (comp (map inc) (filter even?)) + 1 [3 4 5])
11
(reduce #(%2 %1) [(range 10) #(map inc %) reverse])
(10 9 8 7 6 5 4 3 2 1)
(= (list 1 2 3) (map inc (list 0 1 2)))
true
(let [my-counter (atom 100)] (println @my-counter) (swap! my-counter inc) (println @my-counter))
nil
"100\n101\n"
(def facts (concat [1] (lazy-seq (map * facts (iterate inc 1)))))
#'user/facts
(for [row [[1] [2] [3 4]] col row] (inc col))
(2 3 4 5)
(->> [1 34 8] (map inc) (filter even?) (clojure.string/join " -- "))
"2"
(take-while #(< % 5) (map (fn [x] x) (iterate inc 1)))
(1 2 3 4)
(->> [1 2 3] (map inc) (filter pos?) (filter even?) (map dec))
(1 3)
(some-> {:a 0, :b 1} not-empty (update-in [:a] inc) (update-in [:b] dec))
{:a 1, :b 0}
(take 20 (apply (fn [& xs] (filter even? xs)) (iterate inc 0)))
(0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38)
(loop [recur 1] (when (< recur 3) (print "hey") (recur (inc recur))))
nil
"heyhey"
(macroexpand '(take 5 (apply #(filter odd? %&) (iterate inc 0))))
(take 5 (apply (fn* [& %&] (filter odd? %&)) (iterate inc 0)))
((fn rec [n] (if (> n 5) n (rec (inc n)))) 0)
6
(into {} (map (juxt key #(inc (val %))) {:a 1, :b 2}))
{:a 2, :b 3}
(take-while pos? (rest (iterate #(.indexOf "a,bcde,f,gh" (int \,) (inc %)) 0)))
(1 6 8)
((#(fn [& x] (apply % (reverse x))) map) (range 10) inc)
(1 2 3 4 5 6 7 8 9 10)
(take 5 (iterate (fn [[x y]] [(inc x) (dec y)]) [0 0]))
([0 0] [1 -1] [2 -2] [3 -3] [4 -4])
(try (doall (map inc [1 2 3 \f])) (catch Exception e :error))
:error
(into {} (for [[k v] {"jack" 11, "jill" 15}] {(keyword k) (inc v)}))
{:jack 12, :jill 16}
(let [v #{1 2 3}] (into (empty v) (map inc) v))
#{2 3 4}
(first (subseq (apply sorted-map (interleave (range 10) (iterate inc 85))) > 4))
[5 90]
((fn to-five [x] (if (< x 5) (to-five (inc x)) x)) 1)
5
(let [{a 1, b 2} (take 4 (iterate inc 1))] [a b])
[2 nil]
(reduce #(apply %2 [%1]) 1 [inc #(* % 2) even?])
true
(defn drop-nth [i coll] (concat (take i coll) (drop (inc i) coll)))
#'user/drop-nth
(defn count [n] (let [counter (atom n)] #(swap! counter inc)))
#'user/count
(partition 3 (take 30 (iterate #(mod (inc %) 256) 73)))
((73 74 75) (76 77 78) (79 80 81) (82 83 84) (85 86 87) (88 89 90) (91 92 93) (94 95 96) (97 98 99) (100 101 102))
(defn foo [] (loop [n 0] (lazy-seq (cons n (recur (inc n))))))
#'user/foo
(inc (last (take 2 (filter odd? [1 2 3 4 5]))))
4
((fn [aseq] (let [foo (nth aseq 1000000)] foo)) (iterate inc 1))
1000001
(defn d [count sides] (apply + (repeatedly count (inc (rand-int sides)))))
#'user/d
(mapcat #(map inc %&) [1 2 3] [4 5 6])
(2 5 3 6 4 7)
(sequence (comp cat (map inc)) [[0 1 2] [3 4 5]])
(1 2 3 4 5 6)
(reduce #(%2 %1) [[1 2 3] #(map inc %)])
(2 3 4)
(map (juxt identity (comp (partial * 2) inc)) [1 2 3])
([1 4] [2 6] [3 8])
((fn [& args] (map inc args)) 1 2 3 4 5)
(2 3 4 5 6)
(-> 41 atom atom atom atom (swap! swap! swap! swap! inc))
42
((-> 1 ((partial partial inc)) ((fn [x] #(doto (x) prn)))))
2
"2\n"
(apply (fn [& {:keys [foo]}] (inc foo)) (apply concat {:foo 1}))
2
(take-while #(and (even? %) (< % 1000)) (iterate inc 1))
()
(loop [a 1] (if (< a 10) (recur (inc a)) a))
10
(clojure.core/let [G__152 42 G__152 (if even? (clojure.core/-> G__152 inc) G__152)] G__152)
43
(apply str (sequence (comp (map int) (map inc) (map char)) "hello"))
"ifmmp"
(into {} (map (juxt key (comp inc val)) {:a 1, :b 2}))
{:a 2, :b 3}