(clojure.set/difference '#{a b} (set '(b c)))
#{a}
(defmacro frob [form] `(let [a "dog"] (~form)))
#'user/frob
(some #{'b} '[a b c d])
b
(let [a (atom 5)] (take @a (range 9)))
(0 1 2 3 4)
(defmacro mac [a b] `(list ~a '~b))
#'user/mac
(str (seq (lazy-seq '(a b c d))))
"(a b c d)"
(-> cdr a is car other my quote)
(my (other (car (is (a cdr)))))
(vec (concat '[a b] '[3 4]))
[a b 3 4]
(vec '(#^String s #^String a #^String b))
[s a b]
(zipmap (iterate inc 0) '(a b c))
{0 a, 1 b, 2 c}
(-> '(and a b c d) macroexpand-1)
(and a b c d)
(apply concat '[(seq A) nil (seq B)])
(seq A seq B)
(macroexpand '(infix (a + (b * c))))
(infix (a + (b * c)))
(zipmap [1 2 3] '(a b c))
{1 a, 2 b, 3 c}
(defmacro if [a b] `(+ ~a ~b))
#'user/if
(sort-by second > '([a 2] [b 3]))
([b 3] [a 2])
(let [a [1 2 3]] `(5 ~@a))
(5 1 2 3)
(macroexpand-1 '(deffn a [b c] d e))
(deffn a [b c] d e)
(partition 2 1 '(a b c d))
((a b) (b c) (c d))
(assert (number? 'x) "foo is not a number")
nil
(re-seq #".*(s).*" "this is a test")
(["this is a test" "s"])
(macroexpand `(->> a b (->> c d)))
(user/b user/a (user/d user/c))
(let [[a :as x b] [1 2]] x)
[1 2]
(macroexpand '(-> 4 (a (1 4 4))))
(a 4 (1 4 4))
(clojure.walk/macroexpand-all '(-> a (b 1) (c 2)))
(c (b a 1) 2)
(let [a (delay (println :foo) 1)] [@a @a])
[1 1]
":foo\n"
(defmacro plus [a b] `(+ ~a ~b))
#'user/plus
(re-matches #"[A-Z]" "This is a Test")
nil
(apply conj '[a b] '[c d])
[a b c d]
(interleave [1 2 3] '[a b c])
(1 a 2 b 3 c)
(->> (a b c) quote (drop 1) type)
clojure.lang.LazySeq
((fn [[a b c]] c) [1 2 3])
3
(apply (fn [& {:keys [a b c]}] [c b a]) (apply concat {:a 0, :b 1, :c 2}))
[2 1 0]
(let [{:keys [a b c], :as point} (merge {:a 0, :b 1} {:a 3})] [[a b c] point])
[[3 1 nil] {:a 3, :b 1}]
(let [anagram? (fn [a b] (= (frequencies a) (frequencies b)))] (map anagram? ["fred" "meat" "what"] ["derp" "team" "thaw"]))
(false true true)
(->> ["command" "web" "port" "8080"] (partition 2) (map (fn [[a b]] [(keyword a) b])) (apply concat) (apply hash-map))
{:command "web", :port "8080"}
(mapcat (fn [a] (map (fn [b] [a b]) [1 2 3 4 5])) [:a :b :c :d :e])
([:a 1] [:a 2] [:a 3] [:a 4] [:a 5] [:b 1] [:b 2] [:b 3] [:b 4] [:b 5] [:c 1] [:c 2] [:c 3] [:c 4] [:c 5] [:d 1] [:d 2] [:d 3] [:d 4] [:d 5] [:e 1] [:e 2] [:e 3] [:e 4] [:e 5])
(let [my-map {:a 42, :b (zipmap (range 5) (range 5))} {:keys [a b]} my-map] (prn a b))
nil
"42 {0 0, 1 1, 2 2, 3 3, 4 4}\n"
(letfn [(f [x & [a b]] (print (str "x:" x ", a:" a ", b:" b)))] (f 1))
nil
"x:1, a:, b:"
(let [[a b c] (re-matches #"([-+]?[0-9]+)/([0-9]+)" "22/7")] [a b c])
["22/7" "22" "7"]
(map (fn [q a] {:question q, :answer a}) ["from v1" "also from v1"] ["from v2" "also from v2"])
({:answer "from v2", :question "from v1"} {:answer "also from v2", :question "also from v1"})
(let [{:keys [a b c d]} {:a 1, :b 2, :c 3, :d 4}] [a b c d])
[1 2 3 4]
((fn [& {:keys [a b c], :or {c 42, d 100}}] [a b c]) :a 1 :b 2)
[1 2 42]
(let [a [1 2 3] z (map long a) [_ ^long b] z] (= b 2))
true
((fn [& all] (let [xall (butlast all) last2 (last all)] (doall (map #(let [a %] (if (ifn? a) (a) a)) xall)) (let [b last2] (if (ifn? b) (b) b)))) #(println 1) #(do 2) #(do 3) 4 5)
5
"1\n"
(defn partial-137 [f x y z] (fn [a b c d] (f x a y b c d z)))
#'user/partial-137
(let [{:keys [a b c], :or {:a 1, :b 2, :c 3}} {:a 5, :b 6}] [a b c])
[5 6 nil]
(let [a (atom nil)] [(first (filter #(< 1000 %) (map (fn [x] (reset! a x) x) (range)))) @a])
[1001 1001]
(count (filter #(every? (fn [a] (= a :h)) %) (partition 2 1 [:h :t :t :h :h :h])))
2
(let [a {:a 1, :b 2, :c 3} b {:a 1, :c 3}] (= (select-keys a (keys b)) b))
true