(apply + (map #(inc (rand-int %)) (repeat 3 6)))
9
(take 2 (map inc '(3 9 a b c)))
(4 10)
(reduce (fn [a b] (inc a)) '(1 2 3))
3
(->> [1 2 3] (map inc) (map (partial * 2)))
(4 6 8)
(defn next-po10 [n] (-> n (quot 10) inc (* 10)))
#'user/next-po10
(first (map #(do % (print \.)) (iterate inc 1)))
nil
"."
(defn make-counter [] (let [x (atom 0)] (fn [] (swap! x inc))))
#'user/make-counter
(let [[a b c] (iterate inc 1)] [a b c])
[1 2 3]
(let [f (fn [] (fn [y] (inc y)))] (identical? (f) (f)))
false
(nth (iterate #(map inc %) [1 2 3]) 100)
(101 102 103)
(let [n [1 2 3] n (map inc n)] n)
(2 3 4)
(flatten (map #(% 1) ((juxt juxt juxt) inc dec)))
(2 0 2 0)
(defn fac [n] (reduce * (take n (iterate inc 1))))
#'user/fac
(let [n 4] (dotimes [n (inc n)] (prn "test ")))
nil
"\"test \"\n\"test \"\n\"test \"\n\"test \"\n\"test \"\n"
(map deliver (cycle [inc dec]) [1 2 3 4 5])
(2 1 4 3 6)
(map #((first %) (second %)) {inc 1, dec 10})
(2 9)
(chunked-seq? (concat (map inc [1 2 3 4 5]) nil))
false
(let [x 1 (comment as per ticket 32432)] (inc x))
2
(take 9 (filter #(< % 10) (iterate inc 1)))
(1 2 3 4 5 6 7 8 9)
(reduce + (rest (sort (repeatedly 3 #(inc (rand-int 6))))))
10
(let [x [0]] (update-in x [(- (count x) 1)] inc))
[1]
(first ((apply juxt (conj (vec (repeat 500 inc)) println)) 4))
5
"4\n"
((partial map + (map inc (range 5))) (range 10 20))
(11 13 15 17 19)
(->> [1 2] ((juxt (comp dec first) (comp inc second))))
[0 3]
(-> 1 inc (as-> x (reduce + x [2 3])))
7
(into [] (comp (map inc) (filter odd?) (partition-all 3)) (range 30))
[[1 3 5] [7 9 11] [13 15 17] [19 21 23] [25 27 29]]
(sequence (comp (map inc) (filter odd?) (partition-all 3)) (range 30))
([1 3 5] [7 9 11] [13 15 17] [19 21 23] [25 27 29])
(-> {:a 1, :b 2} (dissoc :a) (update-in [:b] inc))
{:b 3}
(reduce (comp inc first list) 0 '("one" "two" "three"))
3
(defmacro foo [x] (let [y (map inc x)] `(prn ~@y)))
#'user/foo
(defn deconcat [coll] ((juxt take drop) (rand-int (inc (count coll))) coll))
#'user/deconcat
(str (last (take (inc (rand-int 2)) (cycle ["yes" "no"]))) " way")
"yes way"
(let [a 1] (let [b (inc a) a :parrot] [b a]))
[2 :parrot]
(defn make-counter [initial] (let [c (atom initial)] (fn [] (swap! c inc))))
#'user/make-counter
(let [afn (fn [i] (inc i))] (map afn [1 2 3]))
(2 3 4)
(defmacro foo [] (let [x (gensym)] `(let [~x 1] (inc ~x))))
#'user/foo
(for [x [1 2 3 4]] (+ (inc x) (dec x)))
(2 4 6 8)
(key (apply max-key (comp inc val) (seq {:a 1, :b 2})))
:b
(sequence (comp (map inc) (map #(* 2 %))) (range 1))
(2)
(let [f (fn [& {a :a}] (inc a))] (f :a 10))
11
(let [a 1] (let [b (inc a) a 1] [b a]))
[2 1]
((fn [x] (if (< x 3) (recur (inc x)) x)) 1)
3
(let [f1 #(inc %)] (defmacro m1 [x] `(~f1 ~x)))
#'user/m1
(-> "(^:awesome f [x] (inc x))" read-string first meta)
{:awesome true}
(do (let [a (atom 0)] (defn make-id [] (swap! a inc))) (make-id))
1
(defn all-integers [n] (lazy-seq (list* n (- n) (all-integers (inc n)))))
#'user/all-integers
(let [a (atom 0)] (dotimes [_ 1000] (swap! a inc)) @a)
1000
(let [the-map {:fn #(inc %)}] (-> the-map :fn (deliver 5)))
6
(let [coll [1 2 3]] (into (empty coll) (map inc coll)))
[2 3 4]
(into {} (for [[k v] {:a 1, :b 2}] [k (inc v)]))
{:a 2, :b 3}