(let [a (atom 10)] (dotimes [n 5] (swap! a inc)) @a)
15(defmacro do1 [form & forms] `(let [ret# ~form] ~@forms ret#))
#'user/do1
(let [{foo :x, :keys [y]} {:x 1, :y 2}] [foo y])
[1 2]
(let [[a b] [1 2 3 4 5]] (list b a))
(2 1)
(let [num 3] (if (= (rem num 5) 0) "buzz" num))
3(let [^{this should, really throw, an exception} foo 42] foo)
42(if false :ORLY (let [a 0 b 1] (+ a b)))
1(let [ks [:a :b :c]] (into {} (zipmap ks (map name ks))))
{:a "a", :b "b", :c "c"}
(defmacro wibble [s] (let [f (symbol s)] `(def ~f "Garble")))
#'user/wibble
(let [x {:a 1}] (assoc (dissoc x :a) :b (:a x)))
{:b 1}
(let [r (map inc [1 2 3])] (first r) (realized? r))
true(let [x 1] (meta (with-meta (list 1 x 3) {:foo x})))
{:foo 1}
(let [{:keys [x z]} '(:x 3 :z 9)] [x z])
[3 9]
(let [m {:one 1, :two 2}] (for [k (keys m)] k))
(:one :two)
(let [{:strs [k1 k2]} {"k1" 1, "k2" 2}] (prn k1 k2))
nil"1 2\n"(let [{x 2, y 5} {2 "hello", 5 "foo"}] [x y])
["hello" "foo"]
(let [evil (resolve (symbol "eval"))] (evil `(+ 1 2 3)))
(clojure.core/+ 1 2 3)
(let [foo-seq (repeatedly #(do (println "lazy-seq evaluated")))] (take 1 foo-seq))
(nil)
"lazy-seq evaluated\n"(let [x 13 coll (range 20)] (filter (partial < x) coll))
(14 15 16 17 18 19)
(let [points [1 2 3]] (map #(points %) [1 2]))
(2 3)
(defmacro m [x] (let [f `(fn [] (println ~x))] `(~f)))
#'user/m
(let [some-datum (list '+ (symbol "iWorshipHisShadow"))] (= some-datum (read-string (print-str some-datum))))
true(let [templ (partial partial format)] ((templ "foo %s %s") "baz" "quux"))
"foo baz quux"(let [{:keys [a b]} {:a true, :b false}] (and a b))
false(let [int (memoize identity)] (identical? (int "test") (int (str "te" "st"))))
true(let [a 0 a (inc a) a (* a a)] a)
1(let [x {:p {:p {:p nil}}}] (take-while identity (iterate :p x)))
({:p {:p {:p nil}}} {:p {:p nil}} {:p nil})
(let [mem-conj (memoize conj)] [(mem-conj '(1) 2) (mem-conj [1] 2)])
[(2 1) (2 1)]
(let [x ^{:line 1, :column 9} (+ 2 3)] x)
5(let [a (atom 0)] (list (swap! a inc) (swap! a inc)))
(1 2)
(let [foo (atom 5)] (defn bar [n] (swap! foo + n)))
#'user/bar
(let [my-counter (atom 100)] (println @my-counter) (swap! my-counter inc) (println @my-counter))
nil"100\n101\n"(let [{:keys [rs/x rs/y]} {:rs/x 1, :rs/y 2}] (prn x y))
nil"1 2\n"(let [x 1 f (fn [arg] (+ arg x))] (f 10))
11(let [a 0xf000] (if (< a 0x8000) a (- a 0x8000)))
28672(let [more '(1 2 3)] `(interpose " " ~more))
(clojure.core/interpose " " (1 2 3))
(let [s [{:id 1} {:id 2}]] (zipmap (map :id s) s))
{1 {:id 1}, 2 {:id 2}}
(let [truncate #(subs %1 0 %2)] (truncate "some string" 4))
"some"(let [x (atom {:a {}, :b []})] (swap! x update-in [:a :a1] {} 123))
{:a {:a1 123}, :b []}
(let [v 1 r (atom 2)] (prn v) (prn (deref r)))
nil"1\n2\n"(let [pad -1] (into (vec (repeat 5 pad)) [1 2 3]))
[-1 -1 -1 -1 -1 1 2 3]
(let [x (atom 10)] (println x) (reset! x 55) (println x))
nil"#object[clojure.lang.Atom 0x25e21416 {:status :ready, :val 10}]\n#object[clojure.lang.Atom 0x25e21416 {:status :ready, :val 55}]\n"(let [xs (range 5)] (clojure.string/join " " (reduce conj xs xs)))
"4 3 2 1 0 0 1 2 3 4"(let [s (str \uFEFF \uFEFF)] (prn s (count s) (clojure.string/blank? s)))
nil"\"\" 2 false\n"(let [yielder (fn [s] (let [a (atom s)] (fn [] (first (swap! a next))))) test (yielder [:conn1 :conn2 :conn3 :conn4])] (for [_ (range 10)] (test)))
(:conn2 :conn3 :conn4 nil nil nil nil nil nil nil)
((fn [& all] (let [xall (butlast all) last2 (last all)] (doall (map #(let [a %] (if (ifn? a) (a) a)) xall)) (let [b last2] (if (ifn? b) (b) b)))) #(println 1) #(do 2) #(do 3) 4 5)
5"1\n"(let [yield (fn [seq] (let [a (atom (cons nil seq))] (fn [] (first (swap! a next))))) test (yield [1 2 3 4])] [(test) (test) (test) (test)])
[1 2 3 4]
(let [{:strs [foo bar]} {"foo" 734, "bar" [1 2 3]}] [foo bar])
[734 [1 2 3]]
(let [m (apply array-map (range 100))] ((juxt class count) (dissoc m 0)))
[clojure.lang.PersistentArrayMap 49]
(let [println (fn [msg] (str msg " foo!"))] (println "I pity the"))
"I pity the foo!"

