(->> (range) (filter odd?) (map #(+ 2 %)) (take 3))
(3 5 7)
(->> "(+ 5 X)" read-string (list 'let ['X 3]))
(let [X 3] (+ 5 X))
(->> (all-ns) (mapcat ns-publics) (mapcat (comp keys meta second)) (into #{}))
#{:arglists :doc :dynamic :macro :name :ns :sci.impl/inlined :sci.impl/op :sci/built-in}
(macroexpand '((->> (+ a b) (fn [a b])) 4 5))
((->> (+ a b) (fn [a b])) 4 5)
(defn f [& ms] (->> (map keys ms) (map set) ...))
#'user/f
(-> [1 2 3] (->> (mapv inc)) (as-> x (x 0)))
2
(->> [1 2 3] (map inc) (map #(/ 2 %)))
(1 2/3 1/2)
(->> [[2 4] [4 343] [5 500]] (map second) (apply max))
500
(defn distinct-by [f coll] (->> coll (group-by f) vals (map first)))
#'user/distinct-by
(-> (+ x x) (->> (fn [x]) (update-in {:a 0} [:a])))
{:a 0}
(->> (format "%.7f" 3.4) reverse (drop-while #{\0}) reverse (apply str))
"3.4"
(->> (range 6 14) (map (comp (partial str "2015-04-") (partial format "%02d"))))
("2015-04-06" "2015-04-07" "2015-04-08" "2015-04-09" "2015-04-10" "2015-04-11" "2015-04-12" "2015-04-13")
(defn palindrome? [num] (->> num str reverse (apply str) (= (str num))))
#'user/palindrome?
(->> (repeat 10000 ['(3) [4]]) (apply concat) (apply concat) (reduce +))
70000
(->> [:a 1 :a 2 :a 3] (partition 2) (map vec) (into {}))
{:a 3}
(defn munge-map-vals [f m] (zipmap (keys m) (->> m vals (map f))))
#'user/munge-map-vals
(into {} (map vector (->> (range 100) shuffle (take 8)) (cycle [1 -1])))
{19 1, 25 1, 26 -1, 46 1, 73 -1, 84 1, 93 -1, 96 -1}
(#(->> % ((juxt namespace name)) (remove nil?) (clojure.string/join "/") symbol) :bar)
bar
(->> (range 100) shuffle (take 8) (map vector (cycle [1 -1])) (into {}))
{-1 22, 1 95}
(->> (range 256) (map char) (filter #(not= (count (pr-str %)) 2)))
(\backspace \tab \newline \formfeed \return \space)
(->> 'clojure.core the-ns ns-map vals (filter var?) (map (comp :file meta)) distinct)
(nil)
(->> :rocks (iterate (fn [x] {:rocks x})) (take 10) (reduce :rocks nil))
{:rocks {:rocks {:rocks {:rocks {:rocks :rocks}}}}}
(->> (concat (range 10) (range 5)) (frequencies) (filter (comp pos? dec val)))
([0 2] [1 2] [4 2] [3 2] [2 2])
(->> '(["x" "y1"] ["x" "y"] ["x1" "y2"]) reverse (into {}) (into []) reverse)
(["x" "y1"] ["x1" "y2"])
(let [needs-two (fn [a b] (+ a b))] (->> 1 (needs-two 1)))
2
(defn naughty? [m] (->> m keys (map type) distinct count (< 1)))
#'user/naughty?
(->> [nil nil 1 nil nil] (drop-while nil?) (take 2) (keep identity))
(1)
(->> "adsadasda" (partition-all 3) (mapcat #(cons "\n" %)) rest (apply str))
"ads\nada\nsda"
(->> contains? var meta :doc (re-seq #"\S") (take 5) (clojure.string/join " "))
"R e t u r"
(->> (iterate inc 0) (reductions +) (take-while #(< % 100)) last)
91
(->> 'clojure.core ns-publics (map first) (map str) (filter #(re-matches #".*!" %)))
("vswap!" "vreset!" "swap-vals!" "disj!" "conj!" "reset-vals!" "pop!" "compare-and-set!" "reset-meta!" "dissoc!" "assoc!" "reset!" "alter-meta!" "persistent!" "run!" "swap!" "volatile!")
(->> [nil nil 1 nil nil] (drop-while nil?) (take 2) (filter identity))
(1)
(->> (ns-publics 'clojure.core) keys (filter #(= \? (last (str %)))) shuffle)
[extends? simple-keyword? counted? rational? chunked-seq? simple-symbol? associative? uuid? seq? boolean? ident? bytes? keyword? number? thread-bound? record? ratio? isa? contains? neg-int? decimal? nat-int? ifn? uri? pos? float? seqable? char? not-every? sequential? some? symbol? nil? double? simple-ident? delay? any? not-any? tagged-literal? qualified-ident? reversible? pos-int? string? neg? sat...
(clojure.walk/macroexpand-all '(->> (range) (filter even?) (drop 100) (map dec) (take 10)))
(take 10 (map dec (drop 100 (filter even? (range)))))
(let [xs [['a 'b] ['a] ['a]]] (->> xs (map set) (reduce clojure.set/intersection)))
#{a}
(defn mmap [m f a] (->> m (f a) (into (empty m))))
#'user/mmap
(->> [1 34 8] (map inc) (filter even?) (clojure.string/join " -- "))
"2"
(->> [1 2 3] (map inc) (filter pos?) (filter even?) (map dec))
(1 3)
(->> [1 5 4 3 2] (map-indexed vector) (apply max-key second) first)
1
(->> "abcdefghijklmnopqrstuvwxyz" (partition 8 8 nil) (interpose [\/]) (apply concat) (apply str))
"abcdefgh/ijklmnop/qrstuvwx/yz"
(macroexpand '(->> [5 4 3 2 1] (drop 2) (take 3)))
(take 3 (drop 2 [5 4 3 2 1]))
(->> (range) (take 10000) (map (partial hash-map :i)) (map count) (reduce +))
10000
(->> (all-ns) (mapcat ns-publics) keys (map name) (filter #(re-matches #".*\..*" %)))
("..")
(let [characters (->> (range 48 58) (concat (range 65 89)) (concat (range 97 123)))] (defn generate-id [] (->> #(rand-nth characters) repeatedly (take 4) (map char) (apply str))))
#'user/generate-id
(->> (all-ns) (mapcat ns-publics) keys (map name) (filter #(.startsWith % "re-")))
("re-groups" "re-seq" "re-pattern" "re-matcher" "re-find" "re-matches" "re-quote-replacement")
(->> "adsadasda" (partition-all 3) (mapcat #(cons "\n" %)) next (apply str))
"ads\nada\nsda"
(let [s (range 10)] (->> s (map inc) (filter even?) (take 3)))
(2 4 6)
(->> (ns-map *ns*) (map (comp name first)) (filter #(.startsWith % "with-")))
("with-bindings*" "with-bindings" "with-open" "with-meta" "with-out-str" "with-in-str" "with-local-vars" "with-redefs" "with-redefs-fn")
(macroexpand-1 '(->> [1 3 5 6 8 10] (filter even?) first))
(first (filter even? [1 3 5 6 8 10]))
(#(* % %) (->> (range 1 100) (filter even?) (reduce +)))
6002500