(binding [*print-dup* true] (let [local 5] (print (fn a-closure [] local))))
nil"#=(sci.impl.fns$fun$arity_0__26683. )"(let [n 4] (dotimes [n (inc n)] (prn "test ")))
nil"\"test \"\n\"test \"\n\"test \"\n\"test \"\n\"test \"\n"(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 [[f l] (.split "hello.txt" ".")] (str f "-timestamp" l))
"-timestamp"(let [x 0 x' (inc x) x'' (inc x')] x'')
2(defmacro ick [p] (let [x (str "<" p ">")] x))
#'user/ick
(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))
(eval `(let [a '6 b '12] (+ a b)))
18(let [foo "foo"] (map #(str foo %) (range 3)))
("foo0" "foo1" "foo2")
(let [x 1 (comment as per ticket 32432)] (inc x))
2(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 [[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 [x [0]] (update-in x [(- (count x) 1)] inc))
[1]
(let [[x & xs] [1 2 3]] (print x xs))
nil"1 (2 3)"(let [x 2] (= '(1 x) (list 1 x)))
false(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 [[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 5 f #(+ % a)] (f 6))
11(let [[function & args] [/ 1 3]] (apply function args))
1/3(let [a #{1 2} a’ (conj a 3)] a’)
#{1 2 3}
(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(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)
(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 10 x (inc x) x (inc x)] x)
12((fn my-fn [x] (let [y 10] (+ x y))) 10)
20(defmacro reffn [& body] `(let [my-fn# (ref (fn ~@body))]))
#'user/reffn
(let [s "#_s"] (read-string (str "(\n" s "\n)")))
()(let [[a b] (seq #{1 2 3 4})] b)
4(let [^{:key (throw (Exception. "hurt me"))} foo 42] foo)
42(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 [a (atom 1)] (swap! a cons '(2 3)))
(1 2 3)
(let [a {} b {:hi 1}] (println a) (println a b))
nil"{}\n{} {:hi 1}\n"(macroexpand '(let [a 1] (-> 1 inc (* 2))))
(let [a 1] (-> 1 inc (* 2)))
(let [times-2 (partial * 2)] (map times-2 [1 2 3]))
(2 4 6)
(defn new-counter [] (let [a (atom 0)] (fn [] (swap! a inc))))
#'user/new-counter
(defmacro stuff [[test]] `(let [test# ~test] (println "got:" test#)))
#'user/stuff
(let [x 1] (meta (with-meta [1 x 3] {:foo x})))
{:foo 1}

