(->> (all-ns) (mapcat ns-publics) (map (comp name key)) (filter #(.endsWith % "!")) (clojure.string/join "; "))
"vswap!; vreset!; swap-vals!; disj!; conj!; reset-vals!; pop!; compare-and-set!; reset-meta!; dissoc!; assoc!; reset!; alter-meta!; persistent!; run!; swap!; volatile!"
(->> [1 2 3 4] (partition 2 1) (every? (fn [[a b]] (== (inc a) b))))
true
(#(do (flatten (->> (last %) (list (reverse (rest (reverse %))))))) '(a b c 2))
(a b c 2)
(->> "Clojure" (map int) (map + (map int "ivatefk") (repeat -107)) (map char) (apply str))
"Awesome"
(->> {:a 1, :b 2} (map #(conj % (first %))) (apply concat) (apply hash-map))
{2 :b, :a :b}
(defn print-spec [] (->> (ns-publics 'clojure.core) keys (map #(eval (list 'doc (symbol "clojure.core" (name %)))))))
#'user/print-spec
(->> [0 1] (iterate (fn [[a b]] [b (+ a b)])) (map first) (take 10))
(0 1 1 2 3 5 8 13 21 34)
(->> (range 100) shuffle (take 8) (vector (cycle [1 -1])) (reverse) (apply map vector) (into {}))
{12 1, 18 1, 39 -1, 44 -1, 47 1, 59 -1, 83 1, 91 -1}
((fn [lo hi f] (->> (- hi lo) (* f) (+ lo))) 5 10 0.5)
7.5
(->> {:apple {:type :foo}, :orange {:type :bar}} (mapcat (fn [[fruit {:keys [type]}]] [type fruit])) (into []))
[:foo :apple :bar :orange]
(defn new-ns-name [] (->> (all-ns) (map str) (mapcat #(clojure.string/split % #"\.")) shuffle (take 3) (clojure.string/join \.)))
#'user/new-ns-name
(let [br (java.io.StringReader. "foo")] (->> (repeatedly #(.read br)) (take-while #(not= % -1)) (map char)))
(\f \o \o)
(->> (concat (repeat 10 0x00) (repeat 2 0xff) [127 0 0 1]) (map char) (apply str))
"
(->> (map :a [{:a 1} {:a 2}]) (filter #(= 1 %)) (#(conj % 2)))
(2 1)
(->> {:a {:b [1 2 3]}} (map #(% 1)) (map first) (map #(% 1)))
([1 2 3])
(->> {:30000 '({:request 1, :values 2} {:request 2, :values 3})} vals first (map :request))
(1 2)
(->> (map (juxt first rest next) [() [] #{} {} nil]) (apply =) (iterate true?) (take 3) (every? true?))
true
(->> (map (juxt first rest next) [() [] #{} {} nil]) (apply =) (iterate true?) (take 3) (apply =))
true
((fn rotate [n coll] (->> (cycle coll) (drop n) (take (count coll)))) 1 [1 2 3])
(2 3 1)
(->> [[:a 50] [:a 10] [:a 30] [:b 20]] (map (partial apply hash-map)) (apply merge-with vector))
{:a [[50 10] 30], :b 20}
(map #((juxt vec (partial reduce +)) (->> (range) (filter odd?) (take %))) (range 1 11))
([[1] 1] [[1 3] 4] [[1 3 5] 9] [[1 3 5 7] 16] [[1 3 5 7 9] 25] [[1 3 5 7 9 11] 36] [[1 3 5 7 9 11 13] 49] [[1 3 5 7 9 11 13 15] 64] [[1 3 5 7 9 11 13 15 17] 81] [[1 3 5 7 9 11 13 15 17 19] 100])
(->> [[1 2 3 4] [:a :b :c :d]] (apply interleave) (partition 2) (apply map list))
((1 2 3 4) (:a :b :c :d))
(->> {:foo :a, :bar :b, :baz :b} (map #(array-map (val %) [(key %)])) (apply merge-with concat))
{:a [:foo], :b (:bar :baz)}
(->> [[:foo "bar"] [:baz "quux"] [:foo "doh"]] (group-by first) (map (fn [[k v]] [k (map last v)])))
([:foo ("bar" "doh")] [:baz ("quux")])
(->> (remove (fn [[k v]] (= v 565)) {:a 565, :b 878, :c 565, :d 997}) (into {}))
{:b 878, :d 997}
(let [m {:foo 7, :bar 8, :baz 7}] (->> m (filter (comp #{7} val)) (map key)))
(:foo :baz)
(->> ["foo" 1 "bar" 2] (map #(if %1 (keyword %2) %2) (cycle [true false])) (apply hash-map))
{:bar 2, :foo 1}
(->> [1 2 3] (mapcat #(list x %)) (apply +) with-out-str (defn totes []) (let [x 15]))
#'user/totes
(->> (transient {:a (transient [1])}) (persistent!) (map (fn [[k v]] [k (persistent! v)])) (apply concat) (apply hash-map))
{:a [1]}
(defn new-ns-name [] (->> (all-ns) (map str) (mapcat #(clojure.string/split % #"\.")) shuffle (take 3) (clojure.string/join \.) symbol))
#'user/new-ns-name
(->> ["Hello" "world"] (#(if (< 0.5 (rand)) (replace {"world" "underworld"} %1) %1)) (clojure.string/join " "))
"Hello world"
(let [s "[^[][['+\ufeff\\"] (->> s (map (comp (partial format "\\u%04x") int)) (apply str) (re-pattern)))
#"\u005b\u005e\u005b\u005d\u005b\u005b\u0027\u002b\ufeff\u005c"
(->> (clojure.string/split-lines "01 02 03\n04 05 06") (map (fn [x] (clojure.string/split x #"\s+"))) flatten (map read-string))
(1 2 3 4 5 6)
(->> (repeatedly 4 #(rand-int 26)) (map #(+ % (int \a))) (map char) (apply str))
"jgyr"
(->> [":add" "+" ":subtract" "-"] (map read-string) (map #(%1 %2) (cycle [identity resolve])) (apply hash-map))
{:add #'clojure.core/+, :subtract #'clojure.core/-}
(->> 'clojure.core ns-publics keys (mapcat (fn [s] (clojure.string/split (name s) #"-"))) shuffle (take 3) (clojure.string/join \-) symbol)
satisfies?-set-unchecked
(defn fib-seq [] ((fn rfib [a b] (->> (+ a b) (rfib b) lazy-seq (cons a))) 1 2))
#'user/fib-seq
(->> (range 1 100) (filter #(zero? (mod % 5))) (filter #(zero? (mod % 7))) first)
35
((-> [n] #(if (zero? n) 1 (* n (fact (- n 1)))) (->> (-> fact))) 10)
3628800
(->> [:h :t :t :h :h :h] (partition 2 1) (filter #(every? #{:h} %)) count)
2
(->> {:apple {:type :foo}, :orange {:type :bar}} (mapcat (fn [[fruit {:keys [type]}]] [(name type) fruit])) (into []))
["foo" :apple "bar" :orange]
(-> (for [x (->> [1 2 3] (map list) (apply concat))] (do (println x) x)) seq boolean)
true
"1\n"
(defn haha [] (->> 'clojure.core ns-publics keys shuffle (take 2) (#(str (first %) '-in- (second %))) symbol))
#'user/haha
(defn h [] (->> 'clojure.core ns-publics keys shuffle (take 2) (#(str (first %) '-in- (second %))) symbol))
#'user/h
(->> (update-in (vec (->> 11 (* (inc 11)) (iterate dec) (take 11) (reverse) (take 1) (first) (range 111) (take (inc 1)) (map char) (reverse) (partition (inc 1) 1) (cycle) (take (inc 1)))) [1] reverse) (flatten) (apply str))
"poop"
(#(->> % (group-by :key1) vals (map first)) [{:k2 "any val", :key1 "12345"} {:k2 "other val", :key1 "12345"}])
({:k2 "any val", :key1 "12345"})
(->> (re-find #"([a-z]+)([A-Z]+.*)" "camelCase") rest (map #(.toLowerCase %)) (interpose \-) (apply str))
"camel-case"
(defn filter-indexed [f coll] (->> coll (map-indexed (fn [i v] [(f i v) v])) (filter first) (map second)))
#'user/filter-indexed
(defn filter-indexed [f coll] (->> coll (map-indexed (fn [[i v]] [(f i v) v])) (filter first) (map second)))
#'user/filter-indexed
(->> [0 1 1 1 0 0 0 1 0 1 1] (partition-by zero?) (map (partial apply +)))
(0 3 0 1 0 2)