(let [n {:polarity :+}] (case (:polarity n) :+ "positive" :- "negative"))
"positive"(let [x #{} y (conj x "foo")] (= x y))
false(let [a 1 b 2 c 3] (+ a b c))
6(let [{:keys [a b]} {:a 2, :b 3, :c 9}] b)
3(let [lookupfn (comp :b :a)] (lookupfn {:a {:b 10}, :c 1}))
10(let [{:keys [a b], :or {b 3}} {:a 1}] [a b])
[1 3]
(let [{:syms [a b]} {'a true, 'b false}] (and a b))
false(let [m [[0 0] [0 0]]] (assoc-in m [0 0] 1))
[[1 0] [0 0]]
(let [f (fn [a b] (+ a b))] (f 1 2))
3(defn make-adder [x] (let [y x] (fn [z] (+ y z))))
#'user/make-adder
(let [{i :foo} {:foo {:bar 1, :baz 2}} output-val [i]] i)
{:bar 1, :baz 2}
(defmacro add-arg [fn] (let [[f#] fn] (prn f#) `(f# "x")))
#'user/add-arg
(let [v [1 2 3]] (into (empty v) (map inc) v))
[2 3 4]
(let [** #(apply * (repeat %2 %1))] (** 2 3))
8(let [{x 1, y 2} {1 2, 3 4}] [x y])
[2 nil]
(let [i 0] [(inc i) (inc i) (inc i) (inc i)])
[1 1 1 1]
(let [[function & args] '(/ 1 3)] (apply function args))
3(let [[a b c] [1 2 3] v [a b]] v)
[1 2]
(let [v ^:v [] m ^:m {}] (binding [*print-meta* true] (prn v m)))
nil"^{:v true} [] ^{:m true} {}\n"(let [printer (memoize (fn [x] (println x)))] (printer 1) (printer 1))
nil"1\n"(let [s (range 5)] (for [i s j s] [i j]))
([0 0] [0 1] [0 2] [0 3] [0 4] [1 0] [1 1] [1 2] [1 3] [1 4] [2 0] [2 1] [2 2] [2 3] [2 4] [3 0] [3 1] [3 2] [3 3] [3 4] [4 0] [4 1] [4 2] [4 3] [4 4])
(let [{foo :x, y :y} {:x 1, :y 2}] [foo y])
[1 2]
(let [foo-seq (repeatedly #(do (println "lazy-seq evaluated"))) bar (rest foo-seq)])
nil"lazy-seq evaluated\n"(let [test (atom #{:a :b})] (swap! test disj @test) @test)
#{:a :b}
(let [a-lazy-seq (map identity [1 2 3])] (identical? a-lazy-seq (seq a-lazy-seq)))
false(let [a '(1 2 3) b '(4 5 6)])
nil(let [big+ #(+ 1 (+ %1 %2))] (big+ 1 1))
3(let [adder (fn [x] #(+ x %))] (type (adder 3)))
sci.impl.fns$fun$arity_1__26688(let [{:keys [a], :as m} {:b 2, :a 1}] [a m])
[1 {:a 1, :b 2}]
(macroexpand (let [a :a b :a] (hash-map a 1 b 2)))
{:a 2}
(let [{:keys [foo bar], :or {foo 5}} {:bar 2}] [foo bar])
[5 2]
(defmacro nils [n] (let [x# (repeat n nil)] `(print ~@x#)))
#'user/nils
(binding [*print-meta* true] (let [foo (with-meta 'x {:type :bla})] (pr-str foo)))
"x"(let [{:keys [a b]} {:a 5, :b 6}] (+ a b))
11(let [{:keys [x y]} {:rs/x 1, :rs/y 2}] (prn x y))
nil"nil nil\n"(let [{x 1, y 2} [1 2 3 4]] [x y])
[2 3]
(let [x [1] y #{x}] (identical? x (get y [1])))
true(let [a (atom 1) b (atom 2)] (reset! a b) @@a)
2(let [x (atom 0)] (with-local-vars [foo @x] (println foo) (println @foo)))
nil"#'G__101645\n0\n"(let [k [0 4] string "foobar"] (eval `(.substring ~string ~@k)))
"foob"(let [m {:a {:b {:c :hello}}}] (-> m :a :b :c))
:hello(let [v [1 2 3]] (update-in v [(dec (count v))] inc))
[1 2 4]
(let [L (with-meta '(a b) {:foo :bar})] (type (pop L)))
clojure.lang.PersistentList(let [c [1]] (every? #{1} (map - (rest c) c)))
true(let [dont-care (empty? (map (fn [_] (println "foo")) [1 2]))] "constant")
"constant""foo\nfoo\n"(let [s "Name: ~name"] (read-string (subs s (inc (.indexOf s "~")))))
name(let [m {:a :b, :c :d}] (zipmap (vals m) (keys m)))
{:b :a, :d :c}
(let [s1 (map println '(1 2 3))] (with-meta s1 {}) nil)
nil"1\n"(let [a (atom {:foo 0})] (swap! a update-in [:foo] + 5))
{:foo 5}
(let [[f & r] (seq (sorted-set 1 3 2))] [f r])
[1 (2 3)]

