(defn new-counter [] (let [x (atom 0)] (fn [] (swap! x inc) x)))
#'user/new-counter
(let [a (array-map Double/NaN 1)] (assoc a (key (first a)) "foo"))
{##NaN 1, ##NaN "foo"}
(let [x 100] (defmacro bare [& _] (list `+ 'x 3)))
#'user/bare
(let [conj (memoize conj)] [(conj [1] 2) (conj '(1) 2)])
[[1 2] [1 2]]
(let [f (fn [{a "a"}] a)] (f {"a" 1, :a 2}))
1(defmacro a [& b] `(let [b# ~(vec b)] b#))
#'user/a
(let [user {:type "tester", :name "hej", :_id "57c6d53e-daca-46b6-92ab-63c3b37de22e"}] (get user :type))
"tester"(let [*print-length* 1] (str '(1 2 3 4 5 6)))
"(1 2 3 4 5 6)"(let [r (range 6)] (map (partial take-nth 2) [r (rest r)]))
((0 2 4) (1 3 5))
(let [v []] (for [item [1 2 3]] (conj v item)) v)
[](let [[entity-id attribute value] [101 :my/attr "woohoo!"]] (println entity-id attribute value))
nil"101 :my/attr woohoo!\n"(map #(let [a %] into {} [[1 2]]) [:a :b :c])
([[1 2]] [[1 2]] [[1 2]])
(defmacro foo [x] `(im (let [y# 1]) (+ ~x y#)))
#'user/foo
(let [a 1 a (inc a) a (* a a)] a)
4(let [[head & rest] [1 2 3]] {:head head, :rest rest})
{:head 1, :rest (2 3)}
(let [a :x] (case a :z 1 (:y :x) 2 :default))
2((fn [aseq] (let [aseq (nth aseq 1000000)] aseq)) (iterate inc 1))
1000001(let [add (fn [α β] (+ α β))] (add 1 2))
3(let [candidates nil n 42] (if (seq candidates) (first candidates) n))
42(let [x 1] (meta ^{:foo x} (list 1 x 3)))
nil(let [x (iterate inc 1)] [(take 5 x) (take 10 x)])
[(1 2 3 4 5) (1 2 3 4 5 6 7 8 9 10)]
(let [[a b] "xy"] (println (int a) ", " (int b)))
nil"120 , 121\n"(let [[f & a] `(~* 5 3)] (apply f a))
15(let [[f & a] '(* 5 3)] (apply f a))
3(let [my-map {}] (map (fn [x] (get my-map x)) [1 2 3]))
(nil nil nil)
(let [{:syms [a b]} '{a 1, b 2}] [a b])
[1 2]
(map #(let [a %] (into {} [[1 2]])) [:a :b :c])
({1 2} {1 2} {1 2})
(let [o (Object.)] (= o (identity o) ((fn [x] x) o)))
true(let [ks '(a b)] (into {} (map (juxt keyword identity) ks)))
{:a a, :b b}
(let [m {:a 1}] (zipmap (map name (keys m)) (vals m)))
{"a" 1}
(let [my-set #{:node-1 :node-3} item :node-3] (contains? my-set item))
true(let [bar (+ 7 2)] `(fn [~bar] (* ~bar 3)))
(clojure.core/fn [9] (clojure.core/* 9 3))
(defmacro do1 [form & body] `(let [result# ~form] ~@body result#))
#'user/do1
(defmacro d [a] `(let [b# (into clojure.lang.PersistentQueue/EMPTY a)] (list b#)))
#'user/d
(let [bar (+ 7 2)] `(fn [bar] (* bar 3)))
(clojure.core/fn [user/bar] (clojure.core/* user/bar 3))
(let [m {:a {:b 1}} {{b :b} :a} m] b)
1(let [as (atom (atom (atom 5)))] (swap! as swap! swap! inc))
6(let [m {:a 1, :b 2}] (= m (read-string (pr-str m))))
true(let [{:keys [a b c]} #{:a :c}] [a b c])
[:a nil :c]
(let [{:keys [foo jam]} '(:foo 12 :bar 17)] [foo jam])
[12 nil]
(let [[a b] [(repeat 10 :foo) #(println "boom!")]] [a b])
[(:foo :foo :foo :foo :foo :foo :foo :foo :foo :foo) #object [sci.impl.fns$fun$arity_0__26683 0x5ab2aa25 "sci.impl.fns$fun$arity_0__26683@5ab2aa25"]]
(let [v [1 2 3]] (into {} [[v 1] [(seq v) 2]]))
{[1 2 3] 2}
(let [x 4 y 1] ((comp + - -) x y))
-3(let [[a b c] [1 2 3]] (+ a b c))
6(defmacro aif [x y] `(let [it ~x] (if it ~y)))
#'user/aif
(let [[& {:keys [a b]}] [:a 1 :b 2]] [a b])
[1 2]
(let [f (+ 3 4) f (+ f 5)] (println f))
nil"12\n"(let [{a "a", b "b"} {"a" 1, "b" 2}] [a b])
[1 2]
(let [vect [1 2 3 4 5]] (map inc (rest vect)))
(3 4 5 6)
(let [is (iterate #(+ 1 %) 0)] (take 5 is))
(0 1 2 3 4)

