(let [items (list 1 2 3 4)] (zipmap items items))
{1 1, 2 2, 3 3, 4 4}
(let [a '(fn [x] (println x))] ((eval a) a))
nil"(fn [x] (println x))\n"(let [s "abcde"] (subs s 0 (- (.length s) 2)))
"abc"(let [[name hp whatever bluh] ["Sgeo" 100 :foo]] [hp name])
[100 "Sgeo"]
(let [{:syms [t1 t2]} {'t1 "hello", 't2 "goodbye"}] [t1 t2])
["hello" "goodbye"]
(let [{f :foo, b :bar} {:foo 1, :bar 2}] f)
1(let [transpose (partial apply map vector)] (transpose [[1 2 3]]))
([1] [2] [3])
(macroexpand '(let [z 0] (meta '#^{:a :b} z)))
(let [z 0] (meta (quote z)))
(defn make-counter [] (let [count (atom 0)] (fn [] (swap! count inc))))
#'user/make-counter
(let [abs (fn [x] (max x (- x)))] (abs -3))
3(let [foo (fn [a] (when a (recur nil)))] (foo true))
nil(let [a :a b :a] (hash-map a 1 b 2))
{:a 2}
(let [data {:foo 'bar}] (or (data :foo) (data "foo") 'baz))
bar(def counter (let [c (atom 0)] (fn [] (swap! c inc))))
#'user/counter
(let [foo (fn [^Integer x] (+ 3 x))] (+ 5))
5(let [{k :k, v :v, :or {k 10}} {}] [k v])
[10 nil]
(let [{x #(:x %1)} {:x "u"}] (println "Hello" x))
nil"Hello nil\n"(let [y [{:a "a", :b "b"}]] (into (into [] [y]) [y]))
[[{:a "a", :b "b"}] [{:a "a", :b "b"}]]
(let [x 5] (println "x is" x) (* 2 x))
10"x is 5\n"(let [given {:fucks 0, :potatoes 1000, :bananas 42}] (:fucks given))
0(let [foo (fn [^Integer x] (+ 3 x))] (foo 5))
8(let [t (repeat 2 (transient []))] (= (first t) (second t)))
true(let [{a 0, b 1} [:A :B :C]] [a b])
[:A :B]
(let [s (set (keys {:a 1}))] [(set? s) (ifn? s)])
[true true]
(let [s (range 10)] (remove #(= 3 %) s))
(0 1 2 4 5 6 7 8 9)
(let [s (range 5)] (doseq [x s] (println x)) 'done)
done"0\n1\n2\n3\n4\n"(let [x (promise) y (fn [] (deliver x :foo))] (y) @x)
:foo(let [m {:foo 1}] (assert (= (m :foo) (:foo m))))
nil(let [[a & x] {:a 1, :b 1}] [a x])
[[:a 1] ([:b 1])]
(let [[a op b] [1 + 1]] (op a b))
2(let [t (atom ["fred"])] (swap! t assoc 0 "ethel") @t)
["ethel"]
(let [l (list 1 2 3)] (identical? l (seq l)))
true(let [kv-pair [:foo 12]] {:rest (rest kv-pair), :second (second kv-pair)})
{:rest (12), :second 12}
(let [x 2] (cond-> 5 (even? x) (+ x 1)))
8(let [f (fn [] #(+ 2 2))] (= (f) (f)))
false(let [m {:a 500}] (= m (assoc m :a 500)))
true(defmacro callme [f] `(let [f# ~f] (if f# (f#))))
#'user/callme
(let [^String x (apply + (range 5))] (* 2 x))
20((fn [f] (let [r (f)] (inc r))) (partial inc 2))
4(let [m {:a :b}] (identical? m (assoc m :a :b)))
true(let [x "5,3"] (apply + (read-string (str \[ x \]))))
8(let [foo "bar"] (if (#{"bar" "foobar"} "bar") 1 2))
1(let [args '(1 2 3 4)] (pop (vec args)))
[1 2 3]
(let [s (seq [1 2])] (identical? (rest s) (rest s)))
false(let [s [(+ 2 3) \a]] [(first s) (second s)])
[5 \a]
(let [var 'foo] `(list ~var '~var ~'var ~'foo 'foo))
(clojure.core/list foo (quote foo) var foo (quote user/foo))
(let [b 137] (map #(bit-and b %) [0xf0 0x0f]))
(128 9)
(macroexpand '(let [executor e {:keys [fn interval]} m] ...))
(let [executor e {:keys [fn interval]} m] ...)
(defmacro let99 [a & body] `(let [~a 99] ~@body))
#'user/let99
(let [x {} y (with-meta x {}) z y] (identical? y z))
true

