(keyword "this really shouldn't be a symbol")
:this
(def foo "this is a foo" 2)
#'user/foo
(keyword "i can make a crazy keyword")
:i
(if-let [[a & bs] (range 5)] bs)
(1 2 3 4)
(def a (delay (do (prn :ok) 1)))
#'user/a
(str (lazy-seq '(a b c d)))
"clojure.lang.LazySeq@9a965e88"
(frequencies (map str (seq "a a b")))
{" " 2, "a" 2, "b" 1}
(macroexpand-1 '(-> a b c d))
(d (c (b a)))
(let [[a b c] [1 2]] c)
nil
(into '[a b] '[c d])
[a b c d]
(prn "It was only a flesh wound!")
nil
"\"It was only a flesh wound!\"\n"
(let [[a b] '(1 2)] b)
2
(meta '#^{:a 1} (a 1 b))
{:a 1, :column 8, :line 1}
(= (let [[a b] [1]] b) nil)
true
(let [q '[(a b) ()]] (first q))
(a b)
(list* 1 2 '#{a b c})
(1 2 a c b)
(def a (map inc [1 2 3]))
#'user/a
(let [[a b c d] (re-matches #"(c)([aeo]{3})(l)" "coool")] [a b c d])
["coool" "c" "ooo" "l"]
(let [[a b c d] [1 2 3 4]] {:a a, :b b, :c c, :d d})
{:a 1, :b 2, :c 3, :d 4}
(defn atom-pop [a] (let [p (promise)] (swap! a #(do (deliver p (first %)) (pop %))) @p))
#'user/atom-pop
(map-indexed #(assoc %2 :index %1) (let [b {:p 19} a {:p 8, :s b}] [a b]))
({:index 0, :p 8, :s {:p 19}} {:index 1, :p 19})
(let [m {:a 1, :b 2, :d 4} {:keys [a b c]} m] [a b c])
[1 2 nil]
(let [f (fn [a b c & more] (+ a b c (first more)))] (apply f (range)))
6
(reduce (fn [[a b] [c d]] (identity [(+ a c) (+ b d)])) (repeat 10 [1 2]))
[10 20]
((fn [{:keys [a b c], :or {c 10}}] [a b c]) {:a 1, :b 2, :c 3})
[1 2 3]
(map (partial apply (fn [& args] (class args))) [[1] (range 2) '(a b) '{a b}])
(clojure.lang.PersistentVector$ChunkedSeq clojure.lang.LongRange clojure.lang.PersistentList clojure.lang.PersistentArrayMap$Seq)
(let [{:keys [a b c]} {:a #{1 2 3}, :b 2, :c 3}] [a b c])
[#{1 2 3} 2 3]
((fn [a b & [foo & bam]] [a b foo bam]) 1 2 :name "steve" :age "paul")
[1 2 :name ("steve" :age "paul")]
(let [a {:a []} c [{:a 2} {:a 3}]] (reduce (partial merge-with conj) {:a []} (conj c a)))
{:a [2 3 []]}
(reduce-kv (fn [a k v] (assoc a k (first v))) {} {:foo [{:bar :baz}], :bar [{:baz :bop}]})
{:bar {:baz :bop}, :foo {:bar :baz}}
(let [a [+ 3 4] b '(+ 3 4)] (str "vector: " (apply (first a) (rest a)) " list: " (apply (first b) (rest b))))
"vector: 7 list: 4"
(let [{a :a, b :b, c :c, :as m, :or {a [2 3], b [3 4]}} {:a [5 6], :c [6 7]}] [a b c m])
[[5 6] [3 4] [6 7] {:a [5 6], :c [6 7]}]
(let [a {0 0, 1 1, 2 2, 3 3, 4 4, 5 5, 6 6, 7 7, 9 9}] [(class (conj a [8 8])) (class a)])
[clojure.lang.PersistentHashMap clojure.lang.PersistentHashMap]
(for [[a b] (map list '(1 2 3) '(:a :b :c)) :when (even? a)] b)
(:b)
(let [[a & b :as keys] (seq [1 2 3 4 5 6 78])] [a b keys])
[1 (2 3 4 5 6 78) (1 2 3 4 5 6 78)]
(let [{:keys [a b], :as m} {:a 1, :b 2} c (inc a) d (inc c)] d)
3
(let [{:keys [a b c], :as m} {:a [5 6], :c [6 7]}] [a b c m])
[[5 6] nil [6 7] {:a [5 6], :c [6 7]}]
(let [b {} a {:s b} items [a b] index-of (reduce (fn [m [x i]] (assoc m i x)) {} (map-indexed vector items))] [(index-of a) (index-of b)])
[0 1]
(loop [i 3 a []] (if (zero? i) a (recur (dec i) (conj a (loop [j 3 b []] (if (zero? j) b (recur (dec j) (conj b [i j]))))))))
[[[3 3] [3 2] [3 1]] [[2 3] [2 2] [2 1]] [[1 3] [1 2] [1 1]]]
(let [what's 'this? a [[36 116 105 109 [101 114 32 49 [54 58 48 58 [48 32 44 40 [108 101 116 32 [91 119 104 97 [116 39 115 32 [39 116 104 105 [115 63 32 97 32]]]]]]]]] "] (println (apply str (apply str (map char (flatten (a 0)))) a (a 1))))"]] (println (apply str (apply str (map char (flatten (a 0)))) a (a 1))))
nil
"$timer 16:0:0 ,(let [what's 'this? a [[36 116 105 109 [101 114 32 49 [54 58 48 58 [48 32 44 40 [108 101 116 32 [91 119 104 97 [116 39 115 32 [39 116 104 105 [115 63 32 97 32]]]]]]]]] \"] (println (apply str (apply str (map char (flatten (a 0)))) a (a 1))))\"]] (println (apply str (apply str (map char (flatten (a 0)))) a (a 1))))\n"
(let [a (make-array Double/TYPE 5 5) b (into-array (map aclone a))] (aset b 2 0 -9.3) (println (aget b 2 0)) (println (aget a 2 0)))
nil
"-9.3\n0.0\n"
(let [base [1 2 3 5 6 8]] (reduce (fn [stack [a b]] (if (= (- a b) -1) (update stack (dec (count stack)) conj a) (conj (update stack (dec (count stack)) conj a) []))) [[]] (partition 2 1 base)))
[[1 2 3] [5 6] []]
(let [[a b] (split-with #(not= 1 %) [5 6 1 2 1 3])] (concat a (next b)))
(5 6 2 1 3)
(let [a (atom 1)] (println "atom is " @a) (swap! a (constantly 2)) (println "atom is " @a))
nil
"atom is 1\natom is 2\n"
(map (fn [a b c d] (a b c d)) [list list] [1 1] [2 2] [3 3])
((1 2 3) (1 2 3))
(let [f (fn [a b c & more] (+ a b c (first more)))] (apply f (range 10)))
6
(for [a [1 2 3] b [4 5 6] c [7 8 9]] [a b c])
([1 4 7] [1 4 8] [1 4 9] [1 5 7] [1 5 8] [1 5 9] [1 6 7] [1 6 8] [1 6 9] [2 4 7] [2 4 8] [2 4 9] [2 5 7] [2 5 8] [2 5 9] [2 6 7] [2 6 8] [2 6 9] [3 4 7] [3 4 8] [3 4 9] [3 5 7] [3 5 8] [3 5 9] [3 6 7] [3 6 8] [3 6 9])
(let [[a b] (split-with #(not= 3 %) [1 2 3 4 5 6])] (concat a (rest b)))
(1 2 4 5 6)
(let [bs [0 1]] (for [a bs b bs c bs d bs] (str a b c d)))
("0000" "0001" "0010" "0011" "0100" "0101" "0110" "0111" "1000" "1001" "1010" "1011" "1100" "1101" "1110" "1111")
(let [xs [[1 2] [3 5] [4 6] [7 9]]] (for [[a b] xs :when (odd? a)] b))
(2 5 9)