(take 2 (take 5 (iterate (fn [x] (do (println x) (inc x))) 1)))
(1 2)
"1\n"
(let [m {:a 1, :b 2}] (zipmap (keys m) (map inc (vals m))))
{:a 2, :b 3}
(doseq [n ["michaeltomer" "hyPiRion" "gfredericks"]] (println (str "(inc " n " )")))
nil
"(inc michaeltomer )\n(inc hyPiRion )\n(inc gfredericks )\n"
(map (fn [x i] (prn x i)) [:a :b :c] (iterate inc 0))
(nil nil nil)
":a 0\n:b 1\n:c 2\n"
(doseq [n ["michaeltomer" "hyPiRion" "gfredericks"]] (println (str "(inc " n ")")))
nil
"(inc michaeltomer)\n(inc hyPiRion)\n(inc gfredericks)\n"
(let [m {:x 1, :y 2}] (zipmap (keys m) (map inc (vals m))))
{:x 2, :y 3}
((fn [_] nil) (nth (iterate #(map inc %) [1 2 3]) 1000))
nil
(for [x [inc dec not identity] :let [z (x 1)] :when z] z)
(2 0 1)
((fn [i] (for [j i] (do (println j) (inc j)))) [1 2 3])
(2 3 4)
"1\n2\n3\n"
(let [a (atom 0)] (while (> 10 @a) (swap! a inc)) (println @a))
nil
"10\n"
(map (juxt (constantly 1) inc (constantly 2) dec (constantly 3)) [5 10 15])
([1 6 2 4 3] [1 11 2 9 3] [1 16 2 14 3])
(for [x (iterate inc 0) :when (even? x) :while (< x 10)] x)
(0 2 4 6 8)
(defn factorial [n] (if (= n 0) 1 (* n (factorial (inc n)))))
#'user/factorial
((partial map + (map inc (range 5))) (range 10 20) (range 420 42))
()
(defn foo [i] (lazy-seq (do (println i) (cons (list i) (foo (inc i))))))
#'user/foo
(map (comp (partial interleave [1 2 3]) (juxt inc dec)) [5 10 15])
((1 6 2 4) (1 11 2 9) (1 16 2 14))
(binding [*print-length* 1] (str (map inc '(1 2 3 4 5 6))))
"clojure.lang.LazySeq@387c1804"
(apply str (concat (range 10) (take 26 (map char (iterate inc (int \a))))))
"0123456789abcdefghijklmnopqrstuvwxyz"
(into {} (for [[k v] {:a 0, :b 1, :c 2}] [k (inc v)]))
{:a 1, :b 2, :c 3}
(into {} (map (fn [[k v]] [k [v (inc v)]]) {:a 1, :b 2}))
{:a [1 2], :b [2 3]}
(map #(map inc %) [[1 2 3 4] [5 6 7 8]])
((2 3 4 5) (6 7 8 9))
(into {} (map #(vector (key %) (inc (val %))) {:a 1, :b 2}))
{:a 2, :b 3}
((fn [aseq] (let [foo (nth aseq 1000000) bar 5] foo)) (iterate inc 1))
1000001
(letfn [(a [x] (inc (b x))) (b [y] (* 2 y))] (a 3))
7
(let [x (atom 0)] (dorun (take 10 (repeatedly #(swap! x inc)))) @x)
10
(reduce (fn [count _] (inc count)) 0 '[a b c d e])
5
(defn p-add [a b] (if (zero? a) b (p-add (dec a) (inc b))))
#'user/p-add
(let [s (iterate inc 0)] (print (take 2 s)) (print (take 2 s)))
nil
"(0 1)(0 1)"
(defn true-times [n] (let [state (atom 0)] (fn [] (> (swap! state inc) n))))
#'user/true-times
(reduce (fn [[i v] x] [(inc i) (conj v x)]) [0 []] (range 5))
[5 [0 1 2 3 4]]
(map #(conj %2 %1) (iterate inc 0) (partition 2 1 [:end] "test"))
((0 \t \e) (1 \e \s) (2 \s \t) (3 \t :end))
(let [r (:repeat {} 0)] (if (< r 2) [r] (range 1 (inc r))))
[0]
(let [x {:a 1, :b 2}] (zipmap (keys x) (map inc (vals x))))
{:a 2, :b 3}
(map #(cond (odd? %) (inc %) (even? %) (dec %)) (range 10))
(-1 2 1 4 3 6 5 8 7 10)
((fn [{a :a, b :b, :or {b (inc a)}}] [a b]) {:a 5})
[5 6]
(first (filter #(not (contains? {1 :a, 2 :b} %)) (iterate inc 1)))
3
(defn remove-from-vector [v i] (into (subvec v 0 i) (subvec v (inc i))))
#'user/remove-from-vector
(reduce #(if (even? %2) (* %1 2) (inc %1)) 1 (range 0 3))
6
((fn [max n] (= n (reduce + (filter odd? (range (inc max)))))) 10 24)
false
(let [coll '([:!f (fn [x] (inc x)) :data])] (fn? (-> coll first second)))
false
(let [vec [0 1 2 3 4 5]] (conj (pop vec) (inc (peek vec))))
[0 1 2 3 4 6]
(def very-lazy (-> (iterate #(do (print \.) (inc %)) 1) rest rest rest))
#'user/very-lazy
".."
(reduce (fn [m [k v]] (assoc m k (inc v))) {} {:a 1, :b 2})
{:a 2, :b 3}
(reduce-kv (fn [m k v] (assoc m k (inc v))) {} {:a 10, :b 20})
{:a 11, :b 21}
(let [m {:x 1, :y 2}] (into {} (for [[k v] m] [k (inc v)])))
{:x 2, :y 3}
(take 4 (flatten [[1 2 3] [4 5 6] [7 8 (iterate inc 0)]]))
(1 2 3 4)
((fn [max n] (= n (reduce + (filter odd? (range (inc max)))))) 10 25)
true
(do (def x 1) (defmacro y [i] `(do (inc ~i) nil)) (y x))
nil
(def x (apply comp (reverse [#(+ 3 %) #(* 2 %) inc])))
#'user/x
(defn adding [x y] (if (= x 0) y (inc (adding (dec x) y))))
#'user/adding