(let [a 0 b (fn [] (println a)) a 1] (b))
nil"0\n"(let [x [1] y [1] z #{x y}] z)
#{[1]}
(let [add +] [(add) (add 1) (add 1 2) add])
[0 1 3 #object [clojure.core$_PLUS_ 0x35b52c2b "clojure.core$_PLUS_@35b52c2b"]]
(defmacro let-foo [v & body] `(let [~'foo ~v] ~@body))
#'user/let-foo
(let [f (fn make-remover [prefix] {:pre [false]} :whut)] (f "okay"))
:whut(let [coll [1 2 3]] (zipmap coll (map inc coll)))
{1 2, 2 3, 3 4}
(defn suround [& rest] (let [& rest] [rest & rest]))
#'user/suround
(let [foo {:x 1, :y 1}] (assoc foo :y 2))
{:x 1, :y 2}
(let [foo [:a :b :c]] (zipmap foo (iterate inc 0)))
{:a 0, :b 1, :c 2}
(let [n 3] (dotimes [n (+ 1 n)] (print n)))
nil"0123"(let [l '(2 8) f '+] (apply f l))
8(let [foo "cheese"] (if (#{"cheese" "bacon"} foo) :contains-fat :fat-free))
:contains-fat(let [{as :as, :as all} {:as "I am"}] [as all])
["I am" {:as "I am"}]
(defmacro a [& b] `(let [b# (vec ~b)] b#))
#'user/a
(let [{:keys [metadata]} (meta (with-meta {:a 5} {:metadata 1}))] metadata)
1(defn f [] (loop [x 1] (let [y x] (recur 2))))
#'user/f
(let [x 10] (when (> x 5) x) (println "yo"))
nil"yo\n"(let [x #^{ :a 1 :b 2} [1]] (meta x))
{:a 1, :b 2}
(repeatedly 10 #(let [a (atom 0)] (swap! a inc)))
(1 1 1 1 1 1 1 1 1 1)
(let [p (promise)] (deliver p "hi") (deliver p "lolwut?") @p)
"hi"(let [f (repeatedly #(println "foo"))] (first f) (second f))
nil"foo\nfoo\n"(let [a 0 b (inc a) c (+ b b)])
nil(defmacro outer [& body] `(let [~'x 5] (do ~@body)))
#'user/outer
(let [m {:a (partial rand-int 15)}] [((:a m)) ((:a m))])
[10 0]
(let [values [:a :b nil]] (if-not (some nil? values) "OK"))
nil(let [v (transient [])] (dotimes [i 10] (conj! v {})) (persistent! v))
[{} {} {} {} {} {} {} {} {} {}]
(defn foo [& [b]] (let [b (or b "default")] b))
#'user/foo
(let [b (doall (for [i (range 5)] (print i)))] nil)
nil"01234"(let [f (with-meta #(inc %) {:awesome true})] (meta f))
{:awesome true}
(let [[k & v] (.split "A;B;C" ";")] [k (vec v)])
["A" ["B" "C"]]
(let [{x :a, & rest} {:a 1, rest 2}] &)
2(let [] (+ 1 2) (+ 10 20) (+ 100 200))
300(let [[& {foo :a, bar 1}] {:a 2}] [foo bar])
[nil 2]
(let [v (vec (first {1 2}))] (identical? v (vec v)))
true(let [{:keys [x y z]} 42] (list x y z))
(nil nil nil)
(let [x {:a :foo}] (defn myfunc [m] (merge m x)))
#'user/myfunc
(let [name 'foo] `(defn ~(symbol (str name "?"))))
(clojure.core/defn foo?)
(let [n (iterate inc 0)] (= (rest n) (rest n)))
true(let [nana (identity Double/NaN)] [(= nana nana) (== nana nana)])
[true false]
(let [xs [1 "foo" {:a "bar"}]] (println xs) (prn xs))
nil"[1 foo {:a bar}]\n[1 \"foo\" {:a \"bar\"}]\n"(let [date-str "2015-08-21"] (map #(Double/parseDouble %) (clojure.string/split date-str #"-")))
(2015.0 8.0 21.0)
(let [a "s"] (case (class a) (class "s") :found :not-found))
:not-found(let [[& {foo :a, bar 1}] [:a 2]] [foo bar])
[2 nil]
(let [v [1 2 3]] (map class [v (rest v)]))
(clojure.lang.PersistentVector clojure.lang.PersistentVector$ChunkedSeq)
(let [form '(prn 1)] (eval `(do ~form ~form)))
nil"1\n1\n"(let [L (with-meta '(a b) {:foo :bar})] (next L))
(b)
(let [x (list 1 2)] (identical? (pop x) (pop x)))
true(binding [*read-eval* true] (read-string "#=(let [a 1] a)"))
1(let [v []] (for [item [1 2 3]] (conj v item)))
([1] [2] [3])
(let [{:strs [a b]} {"a" 1, "b" 2}] [a b])
[1 2]

