(let [n [1 2 3] n (map inc n)] n)
(2 3 4)
(let [[x y z] (range 10000)] (+ x y z))
3(let [x 1] (cond-> 5 (even? x) (+ x 1)))
5(let [{{{c :c} :b} :a} {:a {:b {:c 42}}}] c)
42(defmacro print-eval [x] `(let [x# ~x] (println '~x) x#))
#'user/print-eval
(macroexpand-1 '(let [x :foo {a x} {:foo 1}] a))
(let [x :foo {a x} {:foo 1}] a)
(let [s "foo"] (condp = s "foo" "Win" :else "Lose"))
"Win"(let [int-c (fn [x] (- (int x) 48))] (int-c \0))
0(let [[a b] (seq #{"I wish" "this worked"})] a)
"this worked"(let [[& [bar :as baz]] [1 2 3]] [bar baz])
[1 (1 2 3)]
(let [[_ _ [_ a]] [1 2 [3 4]]] a)
4(let [d1 (Double/parseDouble "NaN") d2 (Double/parseDouble "NaN")] (.equals d1 d2))
true(defn f [] (let [a 1 b 2] (println a b)))
#'user/f
(let [x 2] (= '(1 x) (list 1 x)))
false(let [a 1 b 2] [[a b] '[a b]])
[[1 2] [a b]]
(let [coll (range 1 6)] (map list coll (rest coll)))
((1 2) (2 3) (3 4) (4 5))
(let [x [5 8 12 4]] (take (count x) (range)))
(0 1 2 3)
(let [del (delay 100)] [(type del) (type @del) del @del])
[clojure.lang.Delay java.lang.Long #object [clojure.lang.Delay 0x23720fd3 {:status :ready, :val 100}] 100]
(let [[f l] (.split "hello.txt" ".")] (str f "-timestamp" l))
"-timestamp"(let [x 0 x' (inc x) x'' (inc x')] x'')
2(let [[key val] (first {:a "a", :b "b"})] [key val])
[:a "a"]
(let [ss (sorted-set 1 3 2)] [(first ss) (next ss)])
[1 (2 3)]
(let [a #{1 2} a’ (conj a 3)] a’)
#{1 2 3}
(defmacro ick [p] (let [x (str "<" p ">")] x))
#'user/ick
(let [x [0]] (update-in x [(- (count x) 1)] inc))
[1]
(let [[x & xs] [1 2 3]] (print x xs))
nil"1 (2 3)"(binding [*print-dup* true] (let [local 5] (print (fn a-closure [] local))))
nil"#=(sci.impl.fns$fun$arity_0__26683. )"(let [a 5 f #(+ % a)] (f 6))
11(let [[function & args] [/ 1 3]] (apply function args))
1/3(let [[f s] (clojure.string/split "split me" #" ")] [f s])
["split" "me"]
(let [v ['a 'b 'c]] (interleave (map keyword v) v))
(:a a :b b :c c)
(let [xs [1 2 3]] `(foo a ~@xs b))
(user/foo user/a 1 2 3 user/b)
(let [f-maker (fn [] #(apply + %&))] (identical? (f-maker) (f-maker)))
false(defmacro nif [expr pos zero neg] (let [e (gensym)] `(let [~e ~expr] (cond (pos? ~e) ~pos (zero? ~e) ~zero :else ~neg))))
#'user/nif
(let [v [1 2 3 4]] (dotimes [i 3] (let [i (inc i)] (println (assoc v 0 (v i) i (v 0))))))
nil"[2 1 3 4]\n[3 2 1 4]\n[4 2 3 1]\n"(let [[x] (filter pos? [0 -1 2 1 0])] x)
2(let [a 1 b 2 c 3] [a b c])
[1 2 3]
(let [x 10 x (inc x) x (inc x)] x)
12(let [a (atom 1)] (swap! a cons '(2 3)))
(1 2 3)
(let [^{:key (throw (Exception. "hurt me"))} foo 42] foo)
42(defmacro stuff [[test]] `(let [test# ~test] (println "got:" test#)))
#'user/stuff
(let [x 1] (meta (with-meta [1 x 3] {:foo x})))
{:foo 1}
(let [x 1 x (inc x) x (inc x)] x)
3(let [s "examples"] (->> s count dec (subs s 0)))
"example"(let [a (atom nil)] (reset! a a) (deref a) nil)
nil(let [x [1 2 3]] (if (coll? x) x [x]))
[1 2 3]
(let [{bar :bar, :as stuff} {:bar 1, :foo 2}] stuff)
{:bar 1, :foo 2}
(defmacro fun [& body] `(let [~'name (javax.swing.JLabel. "hi")] ~@body))
#'user/fun
(let [f (fn [& args] (first args))] (apply f (range)))
0(let [{{x :x} :a} {:a {:x "deep"}, :b 0}] x)
"deep"

