(let [{a :a, {a' :a} :b} {:a 0, :b {:a 1}}] [a a'])
[0 1]
(let [a (atom [{} nil])] (swap! a (fn [[m]] [(assoc m :foo :bar) m])))
[{:foo :bar} {}]
(take 7 (let [in (range 1 20)] (map list in (reductions + in))))
((1 1) (2 3) (3 6) (4 10) (5 15) (6 21) (7 28))
(let [coll '(1 3 2 4 6)] (map - coll (rest coll)))
(-2 1 -2 -2)
(let [coll (range 14)] (for [i (range 3)] (take-nth 3 (drop i coll))))
((0 3 6 9 12) (1 4 7 10 13) (2 5 8 11))
(let [thing [[1 2] [3 4] [5 6]]] (for [[x y] thing] y))
(2 4 6)
(let [sm (sorted-map :a 0 :b 1 :c 2)] (dissoc sm (ffirst sm)))
{:b 1, :c 2}
(let [m {:a 1, :b 2, :c 3}] ((apply juxt (keys m)) m))
[1 2 3]
(let [x '(a b c)] `(foo ~'x bar ~@x baz ~x))
(user/foo x user/bar a b c user/baz (a b c))
(let [a (reductions + [1 2 3 4 5])] [a (reduce + a)])
[(1 3 6 10 15) 35]
(let [s [1 2 3]] (take (count s) (partition 2 1 (cycle s))))
((1 2) (2 3) (3 1))
(let [input [1 2 3 4]] (map #(disj (set input) %) input))
(#{2 3 4} #{1 3 4} #{1 2 4} #{1 2 3})
(let [a [1 "foo"] b [(second a) 2]] (identical? (second a) (first b)))
true(let [r (reductions + (range 5))] (if (some nil? r) nil (last r)))
10(let [a (sorted-map :a 1 :b 2 :c 3) k (keys a)] k)
(:a :b :c)
(let [{x :x, {y :x} :m} {:x 1, :m {:x 2}}] [x y])
[1 2]
(let [in-scope? (fn [name] (not (resolve name)))] (map in-scope? '[inc dec foo]))
(false false true)
(let [l [1 2 3 4]] (for [i l j l] [i j]))
([1 1] [1 2] [1 3] [1 4] [2 1] [2 2] [2 3] [2 4] [3 1] [3 2] [3 3] [3 4] [4 1] [4 2] [4 3] [4 4])
(let [large + black 1 phallic 2 cock 3] (large black phallic cock))
6(let [a 0 b (inc a) c (inc b) d (inc c)] d)
3(let [% 10 % (+ % %) % (* 5 %)] (inc %))
101(let [v '(1 2 3 4)] (conj (pop v) (inc (peek v))))
(2 2 3 4)
(let [check (fn [arr] (= (type (double-array 1)) (type arr)))] (check (double-array 3)))
true(let [[a b c d] (seq (set (range 10)))] [a b c d])
[0 7 1 4]
(let [{[foo bar] :keys} {:foo 1, :bar 2}] (println (str foo "\t" bar)))
nil"\t\n"(let [foo (partial + 1 2 3) bar (foo 4 5 6)] bar)
21(let [m [1 4 2 7 8 5]] ((juxt first last) (sort m)))
[1 8]
(let [x (vec (range 32)) y (conj x 1)] (identical? x (pop y)))
false(let [a (map #(println "processing " %) [1 2 3 4])] 'something)
something(let [{:strs [a b]} {"a" 1, "b" 3, "c" 3}] (+ a b))
4(defmacro let-map [& entries] (let [es (partition 2 entries) names (repeatedly gensym)] `(let [~@(mapcat list names (map second es))] (hash-map ~@(mapcat list (map first es) names)))))
#'user/let-map
(let [candidates [1 2 3] n 42] (if (seq candidates) (first candidates) n))
1(defn foo [a &rest [b]] (let [b (or b 'default-b)] (list a b)))
#'user/foo
(let [[foo bar & baz] [1 2 3 4 5]] [foo bar baz])
[1 2 (3 4 5)]
(macroexpand '(let [{:or {a 1, b 2}, a :a, b :b} nil]))
(let [{a :a, b :b, :or {a 1, b 2}} nil])
(let [Who + Worships 1 His 2 Shadow? 3] (Who Worships His Shadow?))
6(defmacro at-ns-do [nms body] (let [actual-ns *ns*] `(binding [*ns* (create-ns ~nms)] ~body)))
#'user/at-ns-do
(let [s "hello there!"] (map (partial apply str) (split-with (complement #{\space}) s)))
("hello" " there!")
(map (juxt type identity) (let [x 1] `[~x x 'x '~x ~'x]))
([java.lang.Long 1] [clojure.lang.Symbol user/x] [clojure.lang.Cons (quote user/x)] [clojure.lang.Cons (quote 1)] [clojure.lang.Symbol x])
(let [s "asdf"] (if-let [match (re-find #"a" s)] `(:yes ~match) '(:no)))
(:yes "a")
(let [L (with-meta (seq '(a b)) {:foo :bar})] (meta (conj L 'c)))
{:foo :bar}
(let [junk [:a :b]] (apply dissoc {:a 1, :b 2, :c 3} junk))
{:c 3}
(defn unsafe? [x] (fn [y] (let [z (+ 2 x)] (+ z y))))
#'user/unsafe?
(defmacro foo [] (let [a + b 1 c 2] `(~a ~b ~c)))
#'user/foo
(let [foo (keyword "f\ufeffo\ufeffo\ufeff")] [foo :foo (= foo :foo) {:foo :foo, foo foo}])
[:foo :foo false {:foo :foo, :foo :foo}]
(let [[a [& b]] [1 '([2 3] [4 5])]] (cons a b))
(1 [2 3] [4 5])
(let [l (range 1 10)] (map #(take % l) (range (count l))))
(() (1) (1 2) (1 2 3) (1 2 3 4) (1 2 3 4 5) (1 2 3 4 5 6) (1 2 3 4 5 6 7) (1 2 3 4 5 6 7 8))
(let [{:keys [a], :as m} {:a 42, :b 11}] [a (dissoc m :a)])
[42 {:b 11}]
(let [compose-n-times (comp (partial reduce comp) repeat) plus-10 (compose-n-times 10 inc)] (plus-10 5))
15(let [coll '(1 3 2 4 6)] (map - coll (rest coll)))
(-2 1 -2 -2)

