(meta (second (macroexpand-1 '(defcomp foo "bar" [a b c] inc dec))))
nil
(clojure.string/replace "a" #"((a)|(h)|(i)|(j))" "$4")
""
(partition-by #{:iftrue :iffalse} '(if x :iftrue a b :iffalse y))
((if x) (:iftrue) (a b) (:iffalse) (y))
(for [x '[a b] y '[c d]] (list x y))
((a c) (a d) (b c) (b d))
(def a (into [] (filter odd?) (map #(doto % println) (range 10))))
#'user/a
"0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n"
((fn [a & r] (class r)) 1 2 3 4 5 6)
clojure.lang.ArraySeq
(let [a '(1 2 3)] `(1 2 3 ~a ~@a))
(1 2 3 (1 2 3) 1 2 3)
(interpose \, (zipmap [1 1 2 3] '[a b c d]))
([1 b] \, [2 c] \, [3 d])
(defmacro testmacro ([a b] `(+ ~a ~b)) ([] `(testmacro 1 2)))
#'user/testmacro
(sort-by count '((a b c) (xx) (aa bb cc dd) (oo)))
((xx) (oo) (a b c) (aa bb cc dd))
(symbol? (symbol ":This has spaces in it and starts with a colon"))
true
(let [{first-thing 0, last-thing 3} '[a b c d]] [first-thing last-thing])
[a d]
((fn [a b & cs] cs) 1 2 3 4 5 6)
(3 4 5 6)
(.replaceAll "Add a backslash in between teh spaces" " " "\\\\ ")
"Add\\ a\\ backslash\\ in\\ between\\ teh\\ spaces"
(assert (and (a? a) (b? b) (c? c) (d? d) (e? e)))
nil
(defrecord Vertex [x y z r g b a s t p])
#'user/Vertex
(take 4 (iterate meta '^^^{:key1 val1} {:key2 val2} {:key3 val3} a))
(a {:key3 val3} nil nil)
(re-seq #"\*(\S+?)\*" "This is a *test* and *another* of regex")
(["*test*" "test"] ["*another*" "another"])
(let [a 1] (eval `(~(fn [b] (+ 1 b)) 2)))
3
(list* (map vector [1 2 3] '(a b c) '(45)))
([1 a 45])
(defn setv "Like set, but returns a vector" [coll] (vec (set coll)))
#'user/setv
((fn [& colls] (apply merge `(~@colls))) '{:option1 a, :option2 b})
{:option1 a, :option2 b}
(reduce #(conj %1 (str %2 "=") %2) [] '(a b c))
["a=" a "b=" b "c=" c]
(if-let [a false] :a (if-let [b true] :b (if-let [c true] :c)))
:b
(for [x [1 2 3] y '[a b c]] [x y])
([1 a] [1 b] [1 c] [2 a] [2 b] [2 c] [3 a] [3 b] [3 c])
(into [] (comp (partition-all 2) (map vec)) '(a 1 b 2 c))
[[a 1] [b 2] [c]]
(let [[:a :b & :rest] [1 2 3 4]] [a b rest])
[1 2 (3 4)]
(let [do2 (fn [f] (fn [[a b & c]] (list* a (f b) c)))] (map (do2 #(str "prefix-" %)) '((123 "foo" 456) (123 "bar" 456))))
((123 "prefix-foo" 456) (123 "prefix-bar" 456))
(let [filter-first (fn [at s] (let [[a b] (split-with #(not (= at %)) s)] (concat a (next b))))] (filter-first 1 '(9 6 1 3 1)))
(9 6 3 1)
(sorted-set-by (fn [a b] (compare (mod (int (first (name a))) 8) (mod (int (first (name b))) 8))) :a :b :c :d :e :f :g :h :i :j)
#{:a :b :c :d :e :f :g :h}
((fn [a b & args] (into (sorted-map) (map (fn [[x y]] [(a x) (b y)]) (partition 2 args)))) identity inc :a 1 :b 2 :c 3)
{:a 2, :b 3, :c 4}
((fn [a & [b & [c & [d & [e & [f]]]]]] [a b c d e f]) 1 2 3 4 5 6 7 8 9)
[1 2 3 4 5 6]
(let [a #(apply str (flatten %)) p partition R rand-nth n #(a (R (mapcat p [1 2 3] %&))) v #(n "aioeu" "iaaiaa")] (a [(n "STKNYPKLGVZ" "GlThShNyFtCh" "ZvrCthShrMycTch") (for [_ " "] [(v) (n "lpstnkgxzv" (concat [(R '[h gl gr nd]) 1 (v)] "rnthggghtsltrkkhshng") "ghnlok")])]))
"Mycahgasl"
(meta (into '{e f} '#^{:some :meta}{a b c d}))
nil
(clojure.string/replace "a" #"((a)|(h)|(i)|(j))" "$2")
"a"
(for [a [[[[4 5]]]] b a c b d c] d)
(4 5)
(some 'e ['{a b, c d} '{e f, g h}])
f
(let [l '(a b c d)] (zipmap (range (count l)) l))
{0 a, 1 b, 2 c, 3 d}
((fn [[a b c d :as lst]] b) [1 2 3 4])
2
((fn [& {:keys [a b], :as m}] m) :a 1 :b 2)
{:a 1, :b 2}
(defmacro methornil [x f a] `(if ~a (~f ~x ~a) ~x))
#'user/methornil
(if-let [[a b c d e f] (repeat 6 nil)] (boolean f))
false
(let [a '((println 10 20) (println 40 50))] `(do ~@a))
(do (println 10 20) (println 40 50))
((fn [x] (if (list? x) x (list x))) '(a b c))
(a b c)
(defn foo [a whole lot of args and & [then some more]])
#'user/foo
(let [[n [d]] '(a (b c d))] {:n n, :d d})
{:d b, :n a}
((fn [& [a b :as all :or {b 42}]] [b all]) 1)
[nil (1)]
(.replaceAll "Add a backslash in between teh spaces" " " "\\ ")
"Add a backslash in between teh spaces"
(let [as [0 1 2 3] bs [9 8 7 6]] (doseq [[a b] (map vector as bs)] (println (format "a %d and b %d" a b))))
nil
"a 0 and b 9\na 1 and b 8\na 2 and b 7\na 3 and b 6\n"
(let [yield (fn [seq] (let [a (atom (cons nil seq))] (fn [] (first (swap! a next))))) test (yield (cycle [:conn1 :conn2 :conn3 :conn4]))] (dotimes [_ 10] (test)))
nil