(defn str-plust-in-map [{a :num} {b :num}] (+ (Integer/parsInt a) (Integer/parseInt b)))
#'user/str-plust-in-map
(let [a :x] (case a :z 1 (:y :x) 2 :default))
2
(remove #('a %) '[b c a d a f])
(b c a d a f)
((fn [{a :a, :as e}] [a e]) {:a "c", :b "d"})
["c" {:a "c", :b "d"}]
(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
((fn [[a b c]] (str a b c)) ['y 'e 's])
"yes"
(apply concat (for [a [1 2 3] b [:a]] [a b]))
(1 :a 2 :a 3 :a)
(defmacro d [a] `(let [b# (into clojure.lang.PersistentQueue/EMPTY a)] (list b#)))
#'user/d
(map (fn [[a b]] [b a]) (seq {:a "a", :b "b"}))
(["a" :a] ["b" :b])
(macroexpand '((->> (+ a b) (fn [a b])) 4 5))
((->> (+ a b) (fn [a b])) 4 5)
(defn duplicate-row? [a b] (= (dissoc a :id) (dissoc b :id)))
#'user/duplicate-row?
(let [{:keys [a b c]} #{:a :c}] [a b c])
[:a nil :c]
(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 [[a b c] [1 2 3]] (+ a b c))
6
(let [[& {:keys [a b]}] [:a 1 :b 2]] [a b])
[1 2]
(let [{a "a", b "b"} {"a" 1, "b" 2}] [a b])
[1 2]
(let [a 1 b 2 c 3] (+ a b c))
6
(let [{:keys [a b], :or {b 3}} {:a 1}] [a b])
[1 3]
(let [{:syms [a b]} {'a true, 'b false}] (and a b))
false
(defmulti foo (fn ([collection] (first collection)) ([a b] (+ a b))))
#'user/foo
(let [f (fn [a b] (+ a b))] (f 1 2))
3
(doseq [[a b] [[1 2] [2 3]]] (prn (+ a b)))
nil
"3\n5\n"
(take 2 (for [a [{:a 1, :b 1} {:a 2, :b 2}] :while (= 2 (a :a))] [a]))
()
(let [ns [3 3.0 3.0M]] (for [a ns b ns] (str a \space b \space (== a b))))
("3 3 true" "3 3.0 true" "3 3.0 true" "3.0 3 true" "3.0 3.0 true" "3.0 3.0 true" "3.0 3 true" "3.0 3.0 true" "3.0 3.0 true")
(do (use 'clojure.set) (let [a (ancestors (type 'wheeee)) b (ancestors (type :wheeee))] [(clojure.set/difference a b) (clojure.set/intersection a b)]))
[#{clojure.lang.AFn clojure.lang.IMeta clojure.lang.IObj} #{clojure.lang.IFn clojure.lang.IHashEq clojure.lang.Named java.io.Serializable java.lang.Comparable java.lang.Object java.lang.Runnable java.util.concurrent.Callable}]
(let [a (atom [])] (clojure.walk/prewalk #(do (swap! a conj %) %) '(+ a (- b c))) @a)
[(+ a (- b c)) + a (- b c) - b c]
((fn [& {a :a, :or {a 10}, :as kwargs}] a) :a "I hate kwargs and you should too")
"I hate kwargs and you should too"
(let [ns [3 3M 3.0 3.0M]] (for [a ns b ns :when (not (== a b))] [a b]))
()
(reductions (fn [a b] (if b (inc a) a)) 0 (map odd? (take 10 (repeatedly #(rand-int 2)))))
(0 0 0 1 1 1 1 1 2 3 4)
(defn zip [a b] (concat [(first a) (first b)] (if (or (= (rest a) '()) (= (rest b) '())) '() (zip (rest a) (rest b)))))
#'user/zip
(let [a (atom [])] (clojure.walk/postwalk #(do (swap! a conj %) %) '(+ a (- b c))) @a)
[+ a - b c (- b c) (+ a (- b c))]
(reduce (fn [a b] [(conj (first a) (first b)) (conj (second a) (second b))]) [[] []] [["a" "1"] ["b" "2"]])
[["a" "b"] ["1" "2"]]
(reduce (fn [a b] (if (> (count a) (count b)) a b)) [[1 1] [1 1 1] [1]])
[1 1 1]
(let [a [1 2 3] _ (prn a) b (map inc a) _ (prn b)] 'foo)
foo
"[1 2 3]\n(2 3 4)\n"
(sort (fn [a b] (cond (< (count a) (count b)) -1 (> (count a) (count b)) 1 :else (.compareTo a b))) ["a" "booc" "aood" "b"])
("a" "b" "aood" "booc")
(reduce (fn [x y] (merge-with (fn [a b] (if (vector? a) (conj a b) (vector a b))) x y)) {} [{:one "2332"} {:one "4334"} {:one "3443"}])
{:one ["2332" "4334" "3443"]}
(let [[a b c] [1 2 3] v [a b]] v)
[1 2]
((fn [[a b] x] (+ a b x)) [1 2] 3)
6
(let [{:keys [a], :as m} {:b 2, :a 1}] [a m])
[1 {:a 1, :b 2}]
(macroexpand (let [a :a b :a] (hash-map a 1 b 2)))
{:a 2}
(defn point [a b c] {:x a, :y b, :z c})
#'user/point
(defmacro stuff ([a b] b) ([a b c] (+ c b)))
#'user/stuff
(let [{:keys [a b]} {:a 5, :b 6}] (+ a b))
11
(let [a (atom 1) b (atom 2)] (reset! a b) @@a)
2
(for [a [1 2 3] b [:a :b :c]] [a b])
([1 :a] [1 :b] [1 :c] [2 :a] [2 :b] [2 :c] [3 :a] [3 :b] [3 :c])
(clojure.walk/macroexpand-all '(->> (->> a #() (-> [b])) #() (-> [a])))
(fn* [a] [] () (fn* [b] [] () a))
(merge-with into (for [[a b] [[:x 1] [:x 2]]] [a [b]]))
([:x [1]] [:x [2]])
(let [a (atom {:foo 0})] (swap! a update-in [:foo] + 5))
{:foo 5}