(-> {:a 0, :b 1} (update-in [:a] inc) (update-in [:b] dec))
{:a 1, :b 0}
(map #(inc (quot (dec %) 25)) [1 25 26 100])
(1 1 2 4)
(let [a {:a 1}] (zipmap (keys a) (map inc (vals a))))
{:a 2}
(map (fn [[key value]] [(inc key) value]) [[0 :a] [1 :b]])
([1 :a] [2 :b])
(into {} (for [[k v] {:a 0, :b 1}] [k (inc v)]))
{:a 1, :b 2}
(into {} (for [[k v] [[1 2] [3 4]]] [k (inc v)]))
{1 3, 3 5}
(into [] (comp (filter even?) (map inc)) [1 2 3 4 5])
[3 5]
((defn my-count [x] ((fn self [y c] (if (next y) (self (next y) (inc c)) (if (first y) (inc c) c))) x 0)) (range 3))
3
(reduce (fn [a b] (inc a)) 0 '(1 2 3))
3
(into {} (for [[k v] {:a 1, :b 2}] [k (inc v)]))
{:a 2, :b 3}
(map inc (set [1 1 1 2 3 4 5 5]))
(2 5 4 3 6)
(sequence (comp (map inc) (map (partial * 10))) [1 2 3])
(20 30 40)
(reduce + 1 (->> [3 4 5] (map inc) (filter even?)))
11
(defn new-counter [] (let [x (atom 0)] (fn [] (swap! x inc) x)))
#'user/new-counter
(macroexpand '(->> (range 10) (map inc) (reduce +)))
(reduce + (map inc (range 10)))
(update-in {:a 1, :b 2, :c {:a 3}} [:c :a] inc)
{:a 1, :b 2, :c {:a 4}}
(-> 2 (* 3) (cond-> (= 1 2) inc) (* 2))
12
(let [a 1 a (inc a) a (* a a)] a)
4
((fn [aseq] (let [aseq (nth aseq 1000000)] aseq)) (iterate inc 1))
1000001
((fn [x] (and (number? x) (< x 10) (inc x))) 1)
2
(defn f [x] (if (zero? x) 0 (inc (f (dec x)))))
#'user/f
(macroexpand `(-> 3 inc dec (as-> b [b (- b)])))
(clojure.core/let [user/b (clojure.core/dec (clojure.core/inc 3))] [user/b (clojure.core/- user/b)])
(let [x (iterate inc 1)] [(take 5 x) (take 10 x)])
[(1 2 3 4 5) (1 2 3 4 5 6 7 8 9 10)]
(loop [x 1] (if (< x 10) (recur (inc x)) x))
10
(defmacro OMG [expr] `(doto ~expr (println (dosync (alter OMG-count inc)))))
#'user/OMG
(let [as (atom (atom (atom 5)))] (swap! as swap! swap! inc))
6
(map #((juxt inc dec) %) [1 2 3 4 5])
([2 0] [3 1] [4 2] [5 3] [6 4])
(nth (iterate #(doall (map inc %)) [1 2 3]) 1000)
(1001 1002 1003)
(-> [1 2 3] (->> (mapv inc)) (as-> x (x 0)))
2
(->> [1 2 3] (map inc) (map #(/ 2 %)))
(1 2/3 1/2)
(let [vect [1 2 3 4 5]] (map inc (rest vect)))
(3 4 5 6)
(apply + (take 3 (map #(inc (rand-int %)) (repeat 6))))
11
(defn positive-numbers ([] (positive-numbers 1)) ([n] (cons n (lazy-seq (positive-numbers (inc n))))))
#'user/positive-numbers
(let [v [1 2 3]] (into (empty v) (map inc) v))
[2 3 4]
(map #(vector %1 %2) [1 2 3] (iterate inc 5))
([1 5] [2 6] [3 7])
(as-> 1 foo (inc foo) (+ 1 foo) (+ foo 5))
8
(binding [*read-eval* true] (read-string "(defn foo [x] (inc x))"))
(defn foo [x] (inc x))
(map inc (filter #(= 0 (mod % 2)) (range 10)))
(1 3 5 7 9)
(macroexpand '(->> [1 2 3] (map inc) #(apply +)))
(fn* [] (apply +) (map inc [1 2 3]))
(let [v [1 2 3]] (update-in v [(dec (count v))] inc))
[1 2 4]
(reduce (fn [letters letter] (update letters letter (fnil inc 0))) {} "hello")
{\e 1, \h 1, \l 2, \o 1}
(loop [x 0] (if (< x 5) (recur (inc x)) x))
5
(let [s "Name: ~name"] (read-string (subs s (inc (.indexOf s "~")))))
name
(let [a (atom 10)] (dotimes [n 5] (swap! a inc)) @a)
15
(apply (fn [& args] (take 3 args)) 1 (iterate inc 10))
(1 10 11)
(macroexpand '(-> {:foo 0} (update :foo inc) (assoc :bar 10)))
(assoc (update {:foo 0} :foo inc) :bar 10)
(-> {:a 1, :b 2} (update-in [:a] inc) (update-in [:b] dec))
{:a 2, :b 1}
(letfn [(f [& y] (first y))] (apply f (iterate inc 0)))
0
(let [r (map inc [1 2 3])] (first r) (realized? r))
true
(let* [temp__3586__auto__ 1] (if temp__3586__auto__ (clojure.core/let [x temp__3586__auto__] (inc x)) :no-such-thing))
2