(letfn [(do-func [f] (f))] (-> (map #(fn [] (prn %)) (range)) (nth 3) do-func))
nil
"3\n"
(binding [*print-dup* true] (letfn [(foo [^Long a] (* a 2))] (-> foo meta pr)))
nil
"nil"
(let [villas ["a" "b" "c"]] (->> (interleave villas (-> villas count range)) (partition 2)))
(("a" 0) ("b" 1) ("c" 2))
(apply hash-map (mapcat #(vector (first %) (-> % second inc)) {:a 1, :b 2}))
{:a 2, :b 3}
(defn update-last [v f & args] (-> v pop (conj (apply f (peek v) args))))
#'user/update-last
(macroexpand '(->> x second (-> @bot :config :prepends first str) (assoc irc-map :message) registry/try-handle))
(registry/try-handle (assoc irc-map :message (-> (clojure.core/deref bot) :config :prepends first str (second x))))
(defn lowercase-keys [m] (zipmap (map #(-> % name .toLowerCase keyword) (keys m)) (vals m)))
#'user/lowercase-keys
(defmacro map-> [& exprs] `(map #(-> % ~@(butlast exprs)) ~(last exprs)))
#'user/map->
(-> [1 2 3 4 5] (#(print %& "\n") 6 7 8 9))
nil
"([1 2 3 4 5] 6 7 8 9) \n"
(-> (for [x (range 1 11) :let [y (/ 1.0 x)]] y) first class)
java.lang.Double
(-> 5 (* 2) (as-> x (if (even? x) (dec x) x)) (- 3))
6
(-> nil (conj ['(foo) 3]) (conj ['(bar) 4]) (conj ['(foo) 5]))
([(foo) 5] [(bar) 4] [(foo) 3])
(-> {} (assoc :k1 'v1) (assoc :k2 [0 1 2 3]) (update-in [:k2 0] inc))
{:k1 v1, :k2 [1 1 2 3]}
(defmacro aaa [expr] (if (-> expr first (= `clojure.string/lower-case)) (first expr) `(+ 5 3)))
#'user/aaa
(defn move [x y target] (-> target (update-in [:x] + x) (update-in [:y] + y)))
#'user/move
(-> {:a 1, :b 2, :c 3} (select-keys [:a :b]) (clojure.set/rename-keys {:a :x, :b :y}))
{:x 1, :y 2}
(-> {:a 1} (with-meta {:x 1}) (conj [:b 2]) (with-meta {:y 2}) (dissoc :b) meta)
{:y 2}
(-> {:a {:b {:c 10}}} (assoc-in [:a :d] 10) (update-in [:a :b :c] * 2))
{:a {:b {:c 20}, :d 10}}
(for [[k v] {:a 1, :b 2, :c 3}] (format "%s -> %s" k v))
(":a -> 1" ":b -> 2" ":c -> 3")
(doseq [x (-> "a b c" .toUpperCase (.replace "C" "X") (.split " "))] (println x))
nil
"A\nB\nX\n"
(-> {:a {:b 4}, :c {:d 3}} (update-in [:a :b] inc) (update-in [:c :d] dec))
{:a {:b 5}, :c {:d 2}}
(update {} :foo (fn [foo] (-> foo (update-in [:bar :quux] (fnil inc 0)) (assoc-in [:string] "string!"))))
{:foo {:bar {:quux 1}, :string "string!"}}
(binding [*print-dup* true] (letfn [(foo [^Long a] (* a 2))] (-> 'foo meta :arglists pr)))
nil
"nil"
(= (let [x (-> [[1 2 3]] first first)] x) (let [[[x]] [[1 2 3]]] x))
true
(defmacro macfoo [string & subs] `(-> ~string ~@(for [sub subs] `(foo ~sub))))
#'user/macfoo
(for [line (.split "abc=66\ndef=25\nhij=99" "\n") pref ["abc" "def"] :when (-> line .toLowerCase (.startsWith pref))] line)
("abc=66" "def=25")
(-> (map first (iterate (fn [[a b]] [b (+ a b)]) [0 1])) (nth 40))
102334155
(#(do (flatten (-> (last %) (list (reverse (rest (reverse %))))))) '(a b c 2))
(2 a b c)
(-> 1 (range 100) ((partial map (comp (partial apply *) (partial repeat 2)))) ((partial apply +)))
328350
(defn mm [a b] (fn [x] (-> x (min (max a b)) (max (min a b)))))
#'user/mm
(let [{:keys [a b], :as m} {:a 1, :b 2}] (-> m (assoc :b (inc a))))
{:a 1, :b 2}
(clojure.string/replace "Hello_$002C_$0021" #"\$(\p{XDigit}{4})" (fn [b] (-> b second (Integer/parseInt 16) char str)))
"Hello_,_!"
(macroexpand '[(-> (a b) (c d) (e f)) (->> (a b) (c d) (e f))])
[(-> (a b) (c d) (e f)) (->> (a b) (c d) (e f))]
(-> (sorted-set [3 2] [1 2 3] [4]) (disj [3 2]) (conj [3 2 1 0]))
#{[1 2 3] [3 2 1 0] [4]}
(let [{:keys [a b], :as m} {:a 1, :b 2}] (-> m (assoc :c (inc a))))
{:a 1, :b 2, :c 2}
(persistent! (reduce (fn [vc [k v]] (-> vc (conj! k) (conj! v))) (transient []) {1 2, 3 4}))
[1 2 3 4]
(let [world (-> nil (assoc-in [:1 :2] "data") (assoc-in [:3 :5] 9))] (update-in world [:3 :5] dec))
{:1 {:2 "data"}, :3 {:5 8}}
(apply str (mapcat (fn [c n] [\u0003 (-> n str first) c \u0003]) "COLORS" (range 2 10)))
"2C3O4L5O6R7S"
(into {} (map (fn [c] [(char c) (-> c (- 32) char)]) (range (int \a) (int \z))))
{\a \A, \b \B, \c \C, \d \D, \e \E, \f \F, \g \G, \h \H, \i \I, \j \J, \k \K, \l \L, \m \M, \n \N, \o \O, \p \P, \q \Q, \r \R, \s \S, \t \T, \u \U, \v \V, \w \W, \x \X, \y \Y}
(macroexpand '(-> [1 2 3] '(map inc) first - dec (+ 3) (min 5)))
(min (+ (dec (- (first (quote [1 2 3] (map inc))))) 3) 5)
(-> (for [x (->> [1 2 3] (map list) (apply concat))] (do (println x) x)) seq boolean)
true
"1\n"
(take 20 (iterate #(->> % - (+ (-> % int (* 2))) inc (/ 1)) 1))
(1 1/2 2N 1/3 3/2 2/3 3N 1/4 4/3 3/5 5/2 2/5 5/3 3/4 4N 1/5 5/4 4/7 7/3 3/8)
(map-indexed (fn [i x] (str i (-> x vec list*))) (partition 2 '(1 2 3 4)))
("0(1 2)" "1(3 4)")
(-> [] (assoc-in [0] [:a]) (assoc-in [0 1] :b) (assoc-in [0 2] [:c]) (assoc-in [0 2 1] :d))
[[:a :b [:c :d]]]
(defn find-imports [fqn] (keep (fn [ns] (when (-> ns meta :imports (or #{}) (contains? fqn)) (.getName ns))) (all-ns)))
#'user/find-imports
(defmacro apply-map [m & {:as km}] `(-> ~m ~@(for [[k v] km] `(update-in [~k] ~v))))
#'user/apply-map
(reduce (fn [m [k f]] (assoc m k (f m))) {:a 1} [[:b #(-> % :a inc)]])
{:a 1, :b 2}
(let [m (sorted-map-by (fn [r s] (compare (str r) (str s))))] (-> m (assoc #"foo" 1) (assoc #"foo" 2)))
{#"foo" 2}
(reduce (fn [acc [x y]] (-> acc (update-in [0] conj x) (update-in [1] conj y))) [[] []] (partition 2 (range 10)))
[[0 2 4 6 8] [1 3 5 7 9]]
(defn move [x y target] (-> target (update-in [:x] #(+ % x)) (update-in [:y] #(+ % y))))
#'user/move