(let [[a b c] [1 2 3]] [b a c])
[2 1 3]
(let [a (range 1 12)] (format "%s" (apply list a)))
"(1 2 3 4 5 6 7 8 9 10 11)"
(defn #=(symbol "hello world") [a b] (+ a b))
#'user/hello
(defn contains-map? [a b] (= (select-keys a (keys b)) b))
#'user/contains-map?
(defn foo [x] (when-let [[a b] x] (list a b)))
#'user/foo
(let [a 2] (condp = a 1 "Hey" 2 "Yo"))
"Yo"
(let [[[a b] c] [[1 2] 3]] [a b c])
[1 2 3]
((fn [a & more] [a more]) 1 2 3 4)
[1 (2 3 4)]
(let [a (range 1 12)] (format "Values: %s" (str a)))
"Values: (1 2 3 4 5 6 7 8 9 10 11)"
(macroexpand-1 '(let [{:keys [b a], :or {b a}} m]))
(let [{:keys [b a], :or {b a}} m])
(for [a (range 5) b (range 6 10)] [a b])
([0 6] [0 7] [0 8] [0 9] [1 6] [1 7] [1 8] [1 9] [2 6] [2 7] [2 8] [2 9] [3 6] [3 7] [3 8] [3 9] [4 6] [4 7] [4 8] [4 9])
((fn [[a b c]] (+ a c)) [1 2 3])
4
(defn dothing [& {:keys [a b c]}] [c b a])
#'user/dothing
(defn poser [a coll] (butlast (mapcat vector coll (repeat a))))
#'user/poser
(doseq [a [1 2] b [3 4]] (println a b))
nil
"1 3\n1 4\n2 3\n2 4\n"
(defn function [f a & more] (map f a more))
#'user/function
(try 1 (finally (for [a [1 2 3]] (println a))))
1
(let [[a b :as all] [1 2]] [a b all])
[1 2 [1 2]]
(for [[a b] (partition 2 1 (range 10))] [a b])
([0 1] [1 2] [2 3] [3 4] [4 5] [5 6] [6 7] [7 8] [8 9])
(let [{:keys [a b]} {:a 1, :b 2}] [a b])
[1 2]
(for [[a b] [[1 2] [3 4]]] (+ a b))
(3 7)
(let [a {:one 1, :two 2}] (map a [:one :two]))
(1 2)
(let [{:keys [a b]} [:a 1 :b 2]] [b a])
[nil nil]
(let [[a _ b] [1 2 3 4]] [a b])
[1 3]
(let [a 1] (case (< a 2) true :yes :no))
:yes
(letfn [(foo [& [a b]] [a b])] (foo 1 2))
[1 2]
(let [[a & b] [1 2 3 4]] [a b])
[1 (2 3 4)]
(for [a [1 2] b [3 4]] (list a b))
((1 3) (1 4) (2 3) (2 4))
(apply (fn [& {:keys [a b c]}] a) {:a 5})
nil
(repeatedly 10 #(let [a (atom 0)] (swap! a inc)))
(1 1 1 1 1 1 1 1 1 1)
(let [a 0 b (inc a) c (+ b b)])
nil
(map (fn [a] (.trim a)) (.split "abc ; 123" ";"))
("abc" "123")
(defn foo [a & [b]] (+ a (or b 5)))
#'user/foo
(defn thrush [a & args] ((apply comp (reverse args)) a))
#'user/thrush
(for [a [1 3] b [5 7]] (* a b))
(5 7 15 21)
((fn [& {a :a, :or {a 10}, :as kwargs}] kwargs))
nil
(let [[a b & rest] (range 10)] [a b rest])
[0 1 (2 3 4 5 6 7 8 9)]
(into {} (for [[b a] {:foo "foo", :bar "bar"}] [a b]))
{"bar" :bar, "foo" :foo}
(defn combine-if [a b] (apply + (remove nil? [a b])))
#'user/combine-if
(defn div-up [a b] (quot (+ a b -1) b))
#'user/div-up
(macroexpand-1 '(let [[a b] [1 2]] (+ a b)))
(let [[a b] [1 2]] (+ a b))
(let [a (identity 25.0) b (identity 25.0)] (= a b))
true
(mapv (fn [a b] [a b]) [:a :b :c] (range))
[[:a 0] [:b 1] [:c 2]]
(defn foo [& [a b :as all]] [a b all])
#'user/foo
(let [{:syms [a b]} {'a 1, 'b 2}] [a b])
[1 2]
(reduce (fn [a b] (inc a)) '(1 2 3))
3
(defn swap [[[a b] [c d]]] [[[a c] [b d]]])
#'user/swap
((fn [{:keys [a b]}] [a b]) {:a 1, :b 2})
[1 2]
(defmacro testmacro ([] (testmacro 1 2)) ([a b] (+ a b)))
#'user/testmacro
(for [a (range 2) b (range 2)] (list a b))
((0 0) (0 1) (1 0) (1 1))