(let [a {:a :b}] (into (empty a) (map identity a)))
{:a :b}
(defmacro test [coll] `(let [f# (first coll)] (println f#)))
#'user/test
(let [m {[0 1] :a} k [0 1]] (m k))
:a(let [lazy-map (memoize println)] (take 3 (repeatedly #(lazy-map 5))))
(nil nil nil)
"5\n"(defmacro with-hello [f] `(let [msg# "Macro"] (println msg#) (~f)))
#'user/with-hello
(let [l '(2 8) f +] (apply f l))
10(let [x (atom 0) y (swap! x inc)] (class y))
java.lang.Long(let [a #(first %&)] (apply a (iterate inc 0)))
0(let [[l r] (split-at 3 (range 10))] (concat r l))
(3 4 5 6 7 8 9 0 1 2)
(let [d (delay "FOO") s (str @d)] (realized? d))
true(let [fred (atom {:name "fred", :address "sycamore street"})] (deref fred))
{:address "sycamore street", :name "fred"}
(let [dfn (with-meta #() {:doc "munger"})] (-> dfn meta :doc))
"munger"(let [x #(:x %1) {:x "u"}] (println "Hello" x))
nil"Hello #object[sci.impl.fns$fun$arity_1__26688 0x2e062d87 sci.impl.fns$fun$arity_1__26688@2e062d87]\n"(let [there? #{0 3 9}] (map there? (range 10)))
(0 nil nil 3 nil nil nil nil nil 9)
(let [x 0 y (fn [] x) x 1] [(y) x])
[0 1]
(let [nana Double/NaN] (every? #(= nana %) '(nana)))
false(let [myproc-2 (fn [f] (f "a") (f "b"))] (myproc-2 println))
nil"a\nb\n"(let [h {:a 1, :b :a}] (-> h :b h))
1(let [f (fn [] '#{"one" "two" "three"})] (identical? (f) (f)))
true(let [m {:foo "bar"}] (identical? m (assoc m :foo "bar")))
false(let [{:keys [x], :as m} {:x 1}] (list x m))
(1 {:x 1})
(let [a (atom [])] [(conj @a 3) (conj @a 4) @a])
[[3] [4] []]
(let [lst '(1 2 3)] (identical? lst (seq lst)))
true(let [xs (cons 1 (lazy-seq (println "forced") '(2)))] xs)
(1 2)
"forced\n"(let [boolean? #{true false}] (map boolean? [1 true false]))
(nil true false)
(let [x [1 2 3]] (identical? (rest x) (rest x)))
false(let [{:strs [t1 t2]} {"t1" "hello", "t2" "goodbye"}] [t1 t2])
["hello" "goodbye"]
(let [{:keys [t1 t2]} {:t1 "hello", :t2 "goodbye"}] [t1 t2])
["hello" "goodbye"]
(let [L (with-meta '(a b) {:foo :bar})] (pop L))
(b)
(let [[#^String x y & z] "abcdef"] [x y z])
[\a \b (\c \d \e \f)]
(let [person {:name "Chuck"}] (read-string "[:h1 (:name person)]"))
[:h1 (:name person)]
(let [f (repeatedly #(println "foo"))] (first f) (first f))
nil"foo\n"(let [c (map (fn overflow [a] (overflow a)) [1])] 5)
5(defmacro hail [name-producer] (let [res# (name-producer)] `(println ~res# ~res#)))
#'user/hail
(let [[[k v]] (seq {:a 42, :b 23})] [k v])
[:a 42]
(let [{:keys [foo bar]} [:foo 'a :bar 'b]] [foo bar])
[nil nil]
(let [p (promise)] (deliver p 1) (deliver p 2) @p)
1(let [x (atom {}) y (atom {})] (swap! x assoc :y y))
{:y #object [clojure.lang.Atom 0x7e1218db {:status :ready, :val {}}]}
(let [{:keys [foo jam]} [:foo 12 :bar 17]] [foo jam])
[nil nil]
(let [a (atom {:a {:b 1}})] (reset! a 2) @a)
2(let [a {:foo [10 20 30]}] (get-in a [:foo 1]))
20(let [x [1 2 3]] `[(foo ~x) (foo ~@x)])
[(user/foo [1 2 3]) (user/foo 1 2 3)]
(let [a 0 b (inc a) b (inc b)] b)
2(do (require 'clojure.walk) (clojure.walk/macroexpand-all '(quote (let [a 1] a))))
(quote (let [a 1] a))
(let [{:keys [x z]} [:x 3 :z 9]] [x z])
[nil nil]
(let [c (range 4)] (map vector c (drop 1 c)))
([0 1] [1 2] [2 3])
(let [s (into (sorted-set) "abcde")] (disj s (first (rseq s))))
#{\a \b \c \d}
(let [s 'foo/bar] [(namespace s) (name s) (type (namespace s))])
["foo" "bar" java.lang.String]
(let [stack (list 1 2 3)] (cons (peek stack) stack))
(1 1 2 3)
(let [m {:a 500}] (identical? m (assoc m :a 500)))
false

