(map first (re-seq #"(a)\1+" "aardvarks are animals, aaaa!"))
("aa" "aaaa")
((fn [[a b c] xs] b) [:a :b :c] :d)
:b
(re-find #"\*(\S+?)\*" "This is a *test* of regex")
["*test*" "test"]
(map #(str % "=" %) '(a b c))
("a=a" "b=b" "c=c")
(defmacro -l [^long a ^long b] `(- ~a ~b))
#'user/-l
(clojure.string/join " " ["some sentences." "in a vector." "like this."])
"some sentences. in a vector. like this."
(macroexpand-1 '(->> a b (->> (c d) (->> e))))
(->> (c d) (->> e) (b a))
(defmacro let99 [a & body] `(let [~a 99] ~@body))
#'user/let99
(defn abc [a b & [c]] (when c (println c)))
#'user/abc
(zipmap [1 1 2 3] '[a b c d])
{1 b, 2 c, 3 d}
(macroexpand '(-> a (b 1 2) (c 3 4)))
(c (b a 1 2) 3 4)
(filter seq (.split " a b c " " +"))
("a" "b" "c")
(map vector '[a b c] '[1 2 3])
([a 1] [b 2] [c 3])
(flatten (map list '[[a b] [c d]] [1 2]))
(a b 1 c d 2)
(defn abc [a b [& c]] (when c (println c)))
#'user/abc
((fn [& {:keys [a b]}] b) :a 5 :b 6)
6
(-> "(def ^:xyz a 1)" read-string second meta)
{:xyz true}
(let [a (atom [])] [(conj @a 3) (conj @a 4) @a])
[[3] [4] []]
(let [L (with-meta '(a b) {:foo :bar})] (pop L))
(b)
(for [e (sort (fn [a b] (compare (a 0) (b 0))) (seq {3 :d, 2 :c, 0 :a, 1 :b}))] (e 1))
(:a :b :c :d)
(let [a (atom false) b "foo" d (delay (if @a (/ 0 1) b))] (try @d (finally (swap! a not) d)))
"foo"
(defn $wap! [a f & args] (let [a' (atom nil)] (swap! a #(do (reset! a' %) (apply f % args))) @a'))
#'user/$wap!
(map (fn [{a 0, b 1, c 4}] [a b c]) [[1 2 3 4 5 6] [-1 -2 -3 -4 -5 -6]])
([1 2 5] [-1 -2 -5])
(reduce (fn [a [k v]] (update-in a [k] (fnil conj []) v)) {} (mapcat (partial map identity) [{:a 1} {:b 2, :a 2} {:b 2}]))
{:a [1 2], :b [2 2]}
(reduce (fn [a {:keys [country count]}] (merge-with + a {country count})) {} [{:count 2, :country "US"} {:count 5, :country "US"} {:count 4, :country "DK"}])
{"DK" 4, "US" 7}
(->> [{:a "x", :b 1} {:a "y", :b 1} {:a "x", :b 1}] frequencies (map (fn [[{a :a} b]] [a b])) (reduce merge {}))
{"x" 2, "y" 1}
(map (partial apply concat) (partition 2 (partition-by '#{a b e h} '[a b c d e f g h i j])))
((a b) (c d e) (f g h))
(do (defn flip [f a b & args] (apply f b a args)) ((partial flip (comp :blah nth) 1) [{:blah "blah"} {:blah "blah2"}]))
"blah2"
(def complex-data ["this is a vector" "the next element can be something other than a string" 10 "then some nesting" [1 2 3]])
#'user/complex-data
(reduce (fn [m [k v]] (update m k (fnil conj #{}) v)) {} '[[a 0] [b 1] [b 2] [a 0] [c 3]])
{a #{0}, b #{1 2}, c #{3}}
((fn [a b & [c d e f]] [a b c d e f]) 1 2 3 4 5 6 7 8 9)
[1 2 3 4 5 6]
(apply map list '((a b) (c d) (e f)))
((a c e) (b d f))
(let [b 2] `(let [a 1] `(~a ~~b)))
(clojure.core/let [user/a 1] (clojure.core/sequence (clojure.core/seq (clojure.core/concat (clojure.core/list user/a) (clojure.core/list 2)))))
(conj (re-seq #".*(s).*" "this is a test") "hello")
("hello" ["this is a test" "s"])
(#((first '(and a b)) % %2) false true)
true
(select-keys '[a b c d e] [0 2 4])
{0 a, 2 c, 4 e}
(apply (fn [a & b] (type b)) [1 2 3])
clojure.lang.PersistentVector$ChunkedSeq
(defn shutdown-agents "Like shutdown-agents but returns a vector." [] (shutdown-agents) (vector))
#'user/shutdown-agents
(macroexpand '(doseq [a (range 50) b (range 50)] (do)))
(loop [seq_2178345 (clojure.core/seq (range 50)) chunk_2178346 nil count_2178347 0 i_2178348 0] (if (clojure.core/< i_2178348 count_2178347) (clojure.core/let [a (clojure.core/nth chunk_2178346 i_2178348)] (loop [seq_2178353 (clojure.core/seq (range 50)) chunk_2178354 nil count_2178355 0 i_2178356 0] (if (clojure.core/< i_2178356 count_2178355) (clojure.core/let [b (clojure.core/nth chunk_2178354 ...
(binding [*print-meta* true] (prn (macroexpand '(-> a (#^Integer b)))))
nil
"^{:line 1, :column 56} (^Integer b a)\n"
(first (read-string "[a b #=(+ 1 3)]"))
a
(map (partial apply intern *ns*) '{a 1, b 2})
(#'user/a #'user/b)
(let [[a b :as x] [1 2 3 4]] x)
[1 2 3 4]
((fn [a b & c] c) :foo :bar :baz :quux)
(:baz :quux)
(defmacro w [a] `(mdo a# <- ~a (return a#)))
#'user/w
(defmacro m [a b] (let [da (when a `(def my-a ~a)) db (when b `(def my-b ~b))] `(do ~da ~db)))
#'user/m
(let [[[a _ _] [_ b _] [_ _ c]] '((1 2 3) (1 2 3) (1 2 3))] (println a b c))
nil
"1 2 3\n"
(let [a [[1 12] [2 23] [4 65]] ks (map first a) b (map - ks (cons -1 ks))] (apply concat (interleave (map #(repeat (dec %) 0) b) (map #(list (second %)) a))))
(0 12 23 0 65)
(let [a #(apply str (flatten %)) p partition R rand-nth n #(a (R (mapcat p [1 2 3] %&))) v #(n "aioeu" "iaaiaa")] (a [(n "STKNYPKLGVZ" "GlThShNyFtCh" "ZvrCthShrMycTch") (for [_ " "] [(v) (n "lpstnkgxzv" (concat [(R ["h" "gl" "gr" "nd"]) (v)] "rnthggghtsltrkkhshng") "ghnlok")])]))
"Tchaaghop"
(letfn [(foo [a b & [x y & rest]] (+ a b (apply * x y rest)))] (foo 1 2 3 4 5 6))
363