(let [coll [1 1]] (identical? (nth coll 0) (nth coll 1)))
true(let [a (hash-map Double/NaN 1)] (assoc a (key (first a)) "foo"))
{##NaN "foo"}
(let [m {:a 1}] (if true (assoc m :b 2) m))
{:a 1, :b 2}
(let [a (atom 1)] [(hash a) (swap! a inc) (hash a)])
[189519051 2 189519051]
(let [[q r] ((juxt quot rem) 43870 3600)] (prn [q r]))
nil"[12 670]\n"(let [roll (fn [g p] (conj g p))] (roll [2] 3))
[2 3]
(let [{a 0, b 3} [4 5 6 7]] [a b])
[4 7]
((fn [x] (when x (let [y (not x)] (recur y)))) true)
nil(let [x (atom nil)] (reset! x #(+ 3 4)) (@x))
7(let [[[fst snd trd]] (list (vector "h1. " "h1" ""))] snd)
"h1"(let [str 1] (doall str (map inc [1 2 3 4])))
(2 3 4 5)
(let [{a :a, :as m} [1 2 4]] (println a m))
nil"nil [1 2 4]\n"(let [[a b c :as d] [1 2 3 4]] d)
[1 2 3 4]
(let [{a :a, b :b} [:a 1 :b 2]] [a b])
[nil nil]
(defmacro mylet [sym expr & body] `(let [~sym ~expr] ~@body))
#'user/mylet
(let [c (.charAt "Hello" 2)] (println (type c)) (= c \l))
true"java.lang.Character\n"(let [[k v :as all] [1 2]] (list k v all))
(1 2 [1 2])
(let [^long x 1] ((fn ^long [^long n] (inc n)) x))
2(let [keys [:a :b]] (zipmap keys ((apply juxt keys) {:a 1})))
{:a 1, :b nil}
(let [m {:foo "bar", :baz "qux"}] (zipmap (vals m) (keys m)))
{"bar" :foo, "qux" :baz}
(let [s (seq [1 2 3])] (identical? (rest s) (rest s)))
false(let [old printf] (defn printf [& args] (apply old args) (flush)))
#'user/printf
(defmacro let-> [val varname & body] `(let [~varname ~val] ~@body))
#'user/let->
(let [[a b :as c] [1 2 3]] [a b c])
[1 2 [1 2 3]]
(let [chores [1 2 3]] (conj (vec (rest chores)) (first chores)))
[2 3 1]
(let [{foo :f, bar :b} {:f 1, :b 2}] [foo bar])
[1 2]
(let [[a b c] [1 2 3]] (println a b c))
nil"1 2 3\n"(let [x 5] (defn blah [y] (fn [] (+ x y 10))))
#'user/blah
(let [[[k v]] '(("a" "b") ("c" "d"))] {k v})
{"a" "b"}
(let [x {:a 1, :b 2}] (zipmap (vals x) (keys x)))
{1 :a, 2 :b}
(let [a (atom {:foo []})] (swap! a update-in [:foo] conj :x) @a)
{:foo [:x]}
(let [{a :foo, b :bar} {:foo 5, :extra 6}] [a b])
[5 nil]
(let [[a b c] '(1 2 3)] [a b c])
[1 2 3]
(let [thing-to-add '(a b c)] (into [:div {:class "test"}] thing-to-add))
[:div {:class "test"} a b c]
(let [more '(1 2 3)] `(interpose " " '~more))
(clojure.core/interpose " " (quote (1 2 3)))
(let [params '(1 2 3 4 5)] (reduce + params))
15(let [items '[a b c]] (map list items (rest items)))
((a b) (b c))
(let [m {:a 1}] (zipmap (keys m) (map inc (vals m))))
{:a 2}
(let [m {:a nil}] (and (contains? m :a) (nil? (m :a))))
true(let [f (fn [] (println *print-length*))] (f) (binding [*print-length* 9000] (f)) (f))
nil"99\n9000\n99\n"(let [s #{:foo :bar} i (first s)] (disj s i))
#{:foo}
(let [[a & [b c]] [1 2 3]] [a b c])
[1 2 3]
(let [a nil b [1]] (if a (conj b a) b))
[1]
(let [x [1 2] newx (conj x 3)] [x newx])
[[1 2] [1 2 3]]
(let [a {:a :b, :c :d}] (str (map reverse (into [] a))))
"clojure.lang.LazySeq@bc3043e0"(let [a [1 2 3]] (identical? a (with-meta a {:b 1})))
false(let [val :the-val] (defn foo [a b] (str val a b)))
#'user/foo
(let [l (with-meta '(1 2 3) {:awesome true})] (meta l))
{:awesome true}
(let [s "12/34/900" ofs (.lastIndexOf s "/")] (subs s (inc ofs)))
"900"(let [m ["the" "quick" "brown" "fox"]] ((juxt first last) (sort m)))
["brown" "the"]

