(list* (for [a [1 2 3]] (* a 2)))
(2 4 6)
(let [a (range 1 12)] (format "%s" (str a)))
"(1 2 3 4 5 6 7 8 9 10 11)"
(defmulti basic (fn [a b] [(class a) (class b)]))
#'user/basic
(map (fn [a] (print a)) [1 2 3 4])
(nil nil nil nil)
"1234"
(defn x [a b c] (+ a b c))
#'user/x
(let [[a b & c] (range 3 9)] a)
3
(for [a [0 1] b (range 4)] [a b])
([0 0] [0 1] [0 2] [0 3] [1 0] [1 1] [1 2] [1 3])
(eval (let [a '6 b '12] (+ a b)))
18
(let [[a b] [1 2 3 4]] [b a])
[2 1]
(for [a (range 7) b (range 7)] [a b])
([0 0] [0 1] [0 2] [0 3] [0 4] [0 5] [0 6] [1 0] [1 1] [1 2] [1 3] [1 4] [1 5] [1 6] [2 0] [2 1] [2 2] [2 3] [2 4] [2 5] [2 6] [3 0] [3 1] [3 2] [3 3] [3 4] [3 5] [3 6] [4 0] [4 1] [4 2] [4 3] [4 4] [4 5] [4 6] [5 0] [5 1] [5 2] [5 3] [5 4] [5 5] [5 6] [6 0] [6 1] [6 2] [6 3] [6 4] [6 5] [6 6])
(do (def a 3) (alter-var-root #'a (constantly 4)) a)
4
(defn foo [& {:keys [b a]}] (+ a b))
#'user/foo
(macroexpand '(let [[a b] [1 2]] [a b]))
(let [[a b] [1 2]] [a b])
(let [{:keys [a b]} #{:a :b}] [a b])
[:a :b]
(defn g [& [a b c]] [a b c])
#'user/g
(for [a '(0 1 2 3)] (print a))
(nil nil nil nil)
"0123"
(for [a (range 3) b (range 3)] [a b])
([0 0] [0 1] [0 2] [1 0] [1 1] [1 2] [2 0] [2 1] [2 2])
(let [a `(typereff nil)] (= (first a) 'typereff))
false
(let [{:keys [a b]} {:name "Joe", :age 30}] a)
nil
((fn [[a b c]] [a b c]) [1 2])
[1 2 nil]
(let [[a [[b]]] [[1 [2 [3 4]]]]] [a b])
[[1 [2 [3 4]]] nil]
(for [a [1 2] b [3 4]] [a b])
([1 3] [1 4] [2 3] [2 4])
((fn [& {a :a}] a) :a 2 :b 4)
2
(map (fn [a] (* a 2)) [1 2 3])
(2 4 6)
(defn x [& {:keys [a b]}] (println a b))
#'user/x
(defmacro foo ([a b] nil) ([a b c] nil))
#'user/foo
(for [a [[1 2] [3 4]] b a] b)
(1 2 3 4)
(let [[a b] [(+ 2 3) \a]] [a b])
[5 \a]
(defn f [& [a & {:keys [k]}]] [a k])
#'user/f
(for [a (range 6) b (range 6)] [a b])
([0 0] [0 1] [0 2] [0 3] [0 4] [0 5] [1 0] [1 1] [1 2] [1 3] [1 4] [1 5] [2 0] [2 1] [2 2] [2 3] [2 4] [2 5] [3 0] [3 1] [3 2] [3 3] [3 4] [3 5] [4 0] [4 1] [4 2] [4 3] [4 4] [4 5] [5 0] [5 1] [5 2] [5 3] [5 4] [5 5])
(defmacro infix [[a op b]] (list op a b))
#'user/infix
(map (fn [[a b]] [a b]) {:foo "1 1"})
([:foo "1 1"])
(defn foo [a b c] (+ a b c))
#'user/foo
(for [a '[0 1 2 3]] (print a))
(nil nil nil nil)
"0123"
(let [[a b] [1 2 3 4]] [a b])
[1 2]
(defn f [[a b c]] (list b a c))
#'user/f
(merge-with (fn [a b] a) {:a 1} {:a 2})
{:a 1}
(map (fn [a b] [a b]) [1 2] "a")
([1 \a])
(let [{:keys [a b]} #{:a :c}] [a b])
[:a nil]
(identical? '(a b c) '(a b c))
false
(let [a "s"] (case (class a) 'java.lang.String :found :not-found))
:not-found
(for [a (rest (range 5)) b (range a)] b)
(0 0 1 0 1 2 0 1 2 3)
(let [[a b c] (range 3)] [c b a])
[2 1 0]
(defn describe [[a b & tail]] [a b tail])
#'user/describe
(for [i (range 5) :let [a i]] a)
(0 1 2 3 4)
(let [a (if (> (rand) 0.49) 42 :else)] a)
42
((fn [n] (letfn [(f [n a] (if (= n 2) a #(f (dec n) (conj a (+' (last a) (nth a (- (count a) 2)))))))] (trampoline f n [0 1]))) 10)
[0 1 1 2 3 5 8 13 21 34]
(let [a (into-array (range 5)) v (vec a)] (aset a 0 17) (get v 0))
17
(defn myfun [pred foo a b] (let [filtered-a (filter pred a)] (map foo a b)))
#'user/myfun
(for [b [:foo :bar] a [1 2 3 1] :while (< a 3)] [b a])
([:foo 1] [:foo 2] [:bar 1] [:bar 2])