((-> [a] #(* 2 a)) 3)
6
(defn foo ([x a] (.foo x a)) ([x a b c] (.foo x a b c)) ([x a b c d] (.foo x a b c d)))
#'user/foo
((fn [f a] (zipmap a (map f a))) inc [1 2 3])
{1 2, 2 3, 3 4}
(let [{a :value, b key, :or {a 10}} {:key "hello"}] [a b])
[10 nil]
(let [a (hash-map Double/NaN 1)] (= (key (first a)) (key (first a))))
true
(let [a {:a 1, :b 2} b (dissoc a :a)] [a b])
[{:a 1, :b 2} {:b 2}]
(macroexpand-1 '(-> (fn [a] (+ a a)) (fn [f] (f 1))))
(fn (fn [a] (+ a a)) [f] (f 1))
(let [a (to-array [1 "foo" (Object.)])] (aset a 1 "bar") (seq a))
(1 "bar" #object [java.lang.Object 0xa4430a3 "java.lang.Object@a4430a3"])
(for [a [true false] b [true false]] [a b (and a b)])
([true true true] [true false false] [false true false] [false false false])
(nth (-> '[win lose lose] (as-> [a b c] [b a c] [c b a] [a c b] [b c a])) 1)
win
(let [a ('{a 1, b 2} 'a) b ('{a 1, b 2} 'b)] (+ a b))
3
(defn reduce-if-not [pred f init s] (loop [a init s s] (if (empty? s) a (let [a (f a (first s))] (when-not (pred a) (recur a (next s)))))))
#'user/reduce-if-not
(apply (fn ([a b c] (+ a (* b c))) ([a b] (+ a b))) [1 2 3])
7
(let [a (object-array 5) v (vec a)] (aset a 0 :hi) v)
[:hi nil nil nil nil]
(apply (fn [& {:keys [a b], :or {a 3}}] [a b]) {:b 2})
[3 nil]
(do (def a 1) (let [f (comp a)] (with-redefs [a (constantly 2)] f)))
1
(let [a '(1 2 3)] (for [x a y a] [x y]))
([1 1] [1 2] [1 3] [2 1] [2 2] [2 3] [3 1] [3 2] [3 3])
(let [a (reductions + [1 2 3 4 5])] [a (reduce + a)])
[(1 3 6 10 15) 35]
(let [a [1 "foo"] b [(second a) 2]] (identical? (second a) (first b)))
true
((fn [{:keys [a b], :or {a 3, b 4}}] [a b]) {:b 2})
[3 2]
(let [{a :a, b :b, :as m, :or {a "a0", b "b0"}} {}] a)
"a0"
((fn [{b :b, a :a, :or {b 2, a (inc b)}}] [a b]) {})
[3 2]
(defn foo [& {:keys [a b], :or {a 1, b 2}}] [a b])
#'user/foo
(for [a (range 5) b (range 10) :while (< b a)] [a b])
([1 0] [2 0] [2 1] [3 0] [3 1] [3 2] [4 0] [4 1] [4 2] [4 3])
(defn foo [& [{:keys [a b], :or {a 1, b 2}}]] [a b])
#'user/foo
(let [a 1 b nil] [(when a (inc a)) (when b (inc b))])
[2 nil]
((fn f ([a] (f a nil)) ([a b] {:a a, :b b})) 1)
{:a 1, :b nil}
(if-let [[a b] (if-let [a 2] (if-let [b 2] [a b]))] "ok" "no")
"ok"
(let [a {:b 1} m {:a a}] (identical? m (assoc m :a a)))
true
(for [a [1 2 3]] (for [b (range a)] {:a a, :b b}))
(({:a 1, :b 0}) ({:a 2, :b 0} {:a 2, :b 1}) ({:a 3, :b 0} {:a 3, :b 1} {:a 3, :b 2}))
((fn [a b] {:pre [(integer? a) (integer? b)]} (+ a b)) 1 2)
3
(let [a nil] (-> 5 ((fn [x] (if a (+ x a) x)))))
5
(let [a 0 b 1] (+ a b))
1
(let [a 1 b 2] (prn [a b]))
nil
"[1 2]\n"
(let [[a b] (re-find #"abc" "abc")] [a b])
[\a \b]
(let [a (atom 0)] (reset! a "foo") @a)
"foo"
(let [[a b c] (range)] [c b a])
[2 1 0]
(defmacro mac [a] (list a 2 3 4))
#'user/mac
(#(for [a %] a) [1 2 3])
(1 2 3)
(defn init [] (defn add5 [a] (+ a 5)))
#'user/init
(defn atom-set [a val] (swap! a (constantly val)))
#'user/atom-set
(macroexpand-1 '(fn [a b] (+ a b)))
(fn [a b] (+ a b))
(let [[a b] (map int "xy")] [a b])
[120 121]
(let [a (atom true)] (reset! a false) @a)
false
((fn [^{:a :b} a] (meta a)) 'param)
nil
(defn x ([a] (x a 0)) ([x y]))
#'user/x
(let [a (atom 1)] (swap! a inc) @a)
2
(let [{a :a} {:a 1, :b 2}] a)
1
(map (fn [a] {:foo a}) [1 2 3])
({:foo 1} {:foo 2} {:foo 3})
(doseq [a (range 1 10)] (println a "!!!"))
nil
"1 !!!\n2 !!!\n3 !!!\n4 !!!\n5 !!!\n6 !!!\n7 !!!\n8 !!!\n9 !!!\n"