(into {} (map (juxt key (comp inc val)) {:a 1, :b 2, :c 3}))
{:a 2, :b 3, :c 4}
(->> [0 1 2] (mapv inc) (#(reduce conj % [11 12 13])))
[1 2 3 11 12 13]
(reduce (fn [words w] (update-in words [w] (fnil inc 0))) {} ["a" "a" "b"])
{"a" 2, "b" 1}
(-> '(1 2 3 4) (#(map %2 %1) #(inc %1)))
(2 3 4 5)
(defn foo™ "Do stuff to bar. Copyright (c) 2011 jcromartie." [bar] (inc bar))
#'user/foo™
(map (fn fact [n] (reduce * (range 1 (inc n)))) (range 1 8))
(1 2 6 24 120 720 5040)
(defn repeat2 [& coll] ((fn rep2 [n vect] (lazy-seq (cons (vect n) (if (= (inc n) (count vect)) (rep2 0 vect) (rep2 (inc n) vect))))) 0 (vec coll)))
#'user/repeat2
(let [a (atom {:a {:b 1}})] (swap! a update-in [:a :b] inc) @a)
{:a {:b 2}}
(mapcat (fn [x] [(dec x) x (inc x)]) [1 2 3 4 5])
(0 1 2 1 2 3 2 3 4 3 4 5 4 5 6)
((partial map + (map inc (range 5))) (range 10 20) (range 42 420))
(53 56 59 62 65)
(defn factoring [n] (filter #(zero? (rem n %)) (range 1 (inc n))))
#'user/factoring
(filter (juxt inc dec) [1 2 3 4 5 6 7 8 9])
(1 2 3 4 5 6 7 8 9)
(loop [i 0] (if (< i 10) (do (println i) (recur (inc i)))))
nil"0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n"(into {} (map (fn [[k v]] [(str k) (inc v)]) {:foo 12, :bar 34}))
{":bar" 35, ":foo" 13}
(conj (vec (drop-last [1 2 3 4])) (inc (last [1 2 3 4])))
[1 2 3 5]
(update-in [[0 1 2] [1 2 3] [2 3 0]] [1 2] inc)
[[0 1 2] [1 2 4] [2 3 0]]
(let [in-scope? (fn [name] (not (resolve name)))] (map in-scope? '[inc dec foo]))
(false false true)
(let [% 10 % (+ % %) % (* 5 %)] (inc %))
101(let [v '(1 2 3 4)] (conj (pop v) (inc (peek v))))
(2 2 3 4)
(reduce #(do %2 (inc %)) 0 '[a b c d e])
5(map-indexed (fn [a b] [(inc a) b]) [:a :b :c :d :e])
([1 :a] [2 :b] [3 :c] [4 :d] [5 :e])
(for [y (range 0 3) x (range 0 (inc y))] [y x])
([0 0] [1 0] [1 1] [2 0] [2 1] [2 2])
(reduce #(update-in %1 (first %2) (second %2)) {:a 1} {[:a] inc})
{:a 2}
(defmacro m1 [x] `(let [f# (fn [y#] (inc y#))] (f# ~x)))
#'user/m1
(map #(update-in % [:age] inc) [{:age 1} {:age 2} {:age 3}])
({:age 2} {:age 3} {:age 4})
(let [f (fn [] (fn [y] (inc y)))] (identical? (class (f)) (class (f))))
true(loop [cnt 0] (if-not (= cnt 3) (recur (inc cnt)) (println "done")))
nil"done\n"(defn make-counter [] (let [counter (atom 0)] (fn [] (swap! counter inc) (deref counter))))
#'user/make-counter
((fn fn-name [a] (if (odd? a) (fn-name (inc a)) (str a))) 1)
"2"(let [f (fn [& x] (first x))] (apply f (iterate inc 0)))
0(remove #{\c \d} (map char (range (int \a) (inc (int \z)))))
(\a \b \e \f \g \h \i \j \k \l \m \n \o \p \q \r \s \t \u \v \w \x \y \z)
(let [funcall (fn [f & args] (apply f args))] (funcall inc 1))
2(loop [i 0] (if (> i 5) (println "done") (recur (inc i))))
nil"done\n"(map (fn [x] (+ (inc x) (dec x))) [1 2 3 4])
(2 4 6 8)
(->> (iterate inc 0) (reductions +) (take-while #(< % 100)) last)
91(map (fn [x] {(first x) (inc (second x))}) {:a 1, :b 2})
({:a 2} {:b 3})
(-> {:a 1, :b 2} (dissoc :a) (doto println) (update-in [:b] inc))
{:b 3}
"{:b 2}\n"(map #(if (number? %) (inc %) %) [1 :two 3 :four])
(2 :two 4 :four)
(defn step [m item] (assoc m item (inc (get m item 0))))
#'user/step
(map (partial clojure.walk/walk inc identity) [[1 2 3] '(1 2 3)])
([2 3 4] (2 3 4))
(-> 1 (doto prn) inc (doto prn) (* 10) (doto prn) dec)
19"1\n2\n20\n"(let [binding 'x body '(inc x)] `(let [binding 10] ~body))
(clojure.core/let [clojure.core/binding 10] (inc x))
(do (println "add me to this result") (println "another line") (inc 1))
2"add me to this result\nanother line\n"(defn true-times [n] (let [state (atom 0)] (> (swap! state inc) n)))
#'user/true-times
(into {} (map (fn [[k v]] [(keyword k) (inc v)]) {"jack" 12, "jill" 15}))
{:jack 13, :jill 16}
(-> [1 2 3] (as-> xs (map inc xs) (do (println xs) xs)))
(2 3 4)
"(2 3 4)\n"(for [k (keys {1 1, 2 2, 3 3, 4 4})] (inc k))
(2 3 4 5)
(reduce #(assoc % (first %2) (inc (second %2))) {} {:a 1, :b 2})
{:a 2, :b 3}
(mapcat (fn [[x y]] [(inc x) y]) {1 2, 3 4, 5 6})
(2 2 4 4 6 6)
(let [compose-n-times (comp (partial reduce comp) repeat) plus-10 (compose-n-times 10 inc)] (plus-10 5))
15

