(let [a (atom {})] (swap! a assoc :a 0) (swap! a assoc :b 1))
{:a 0, :b 1}
(for [a (range 2) b (range a) c (range b)] [a b c])
()
(defn p-add [a b] (if (zero? a) b (p-add (dec a) (inc b))))
#'user/p-add
(let [{:keys [a b], :or {a 1, b 2}} {:a 5}] [a b])
[5 2]
(defn gcd [a b] (if (zero? b) a (recur b (mod a b))))
#'user/gcd
(let [a (object-array 64) v (vec a)] (aset a 0 :hi) v)
[nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil]
((fn [{a :a, b :b, :or {b (inc a)}}] [a b]) {:a 5})
[5 6]
(let [invoker (fn ([a] (. Integer valueOf a)) ([a b] (. Integer valueOf a b)))] (apply invoker ["100" 2]))
4
((fn f ([a b] (f a b 5)) ([a b & c] (apply + a b c))) 1 2)
8
(letfn [(f1 [a & bs] [a bs]) (f2 [a & bs] (apply f1 a bs))] (f2 1 2 3))
[1 (2 3)]
(defn- entity-equals [a b] (let [a (merge (zipmap (keys b) (repeat nil)) (select-keys a (keys b)))] (= a b)))
#'user/entity-equals
(let [[a b] [1 2 3]] [a b])
[1 2]
(defmacro foop [a] `(quote ~(type a)))
#'user/foop
(let [m {:a 1} {:keys [a]} m] a)
1
(do (def a 1) (alter-var-root #'a inc) a)
2
((fn [& a] (type a)) 1 2 3)
clojure.lang.ArraySeq
(let [a (atom 1)] (swap! a (constantly 2)))
2
(defn iwc [a b] '(+ a b))
#'user/iwc
(let [{a :a} {:a "a", :b "b"}] a)
"a"
(let [[a b] (seq #{1 2})] a)
1
(let [m {:a 1} {a :a} m] a)
1
(when-let [{:keys [a b]} {:c 1}] [a b])
[nil nil]
(defn foo [a] (str "Hello " a "!"))
#'user/foo
(let [a (atom 0)] (swap! a + 5))
5
(let [{:keys [a b]} {:a 1}] (println a))
nil
"1\n"
(defn three-params [a b c] [a b c])
#'user/three-params
(defn foo [a #^Integer b] (+ a b))
#'user/foo
(for [{a :a} [{:a 1, :b 2}]] a)
(1)
(defn ^{:tag 'long} x [^long a] a)
#'user/x
(defn #^Integer foo [a b] (+ a b))
#'user/foo
(let [{:keys [a b]} {"a" 1}] (println a))
nil
"nil\n"
(defmulti foo (fn [a & _] (class a)))
#'user/foo
(do (def a 3) (alter-var-root #'a inc) a)
4
(let [a (fn [_] (println "hello"))] (a "ok"))
nil
"hello\n"
((fn f [{:keys [a]}] (inc a)) {:a 1})
2
(let [a 5 b 6] (+ a b))
11
(macroexpand-1 '(fn [[a b]] (+ a b)))
(fn [[a b]] (+ a b))
(for [a (range 5) b (range a)] b)
(0 0 1 0 1 2 0 1 2 3)
((let [a 2 b 3] (fn [] [a b])))
[2 3]
(let [a nil b 43] (or a b))
43
(remove '#{a b} '[a b c])
(c)
((fn [a b] (+ a b)) 5 6)
11
(map (fn [a] a) [1 2 3 4])
(1 2 3 4)
((-> [a b] (fn [b a])) 1 2)
[2 1]
((fn [[_ a]] (inc a)) (list 10 11))
12
(defn myf [a & [options]] (println a options))
#'user/myf
(let [a 42] (fn [a*] (a*)) (var a))
42
(macroexpand '(fn [[a b]] (+ a b)))
(fn [[a b]] (+ a b))
(defrecord R [a])
#'user/R
(def ^:mykey a)
#'user/a