(let [f (partial (fn [a b] (str a " " b)) "fixed")] (println (f "one")) (println (f "two")))
nil
"fixed one\nfixed two\n"
(let [a (sorted-map :a 1 :b 2 :c 3) k (keys a)] (take-while #(not= % :c) k))
(:a :b)
(mapcat (fn [[a b]] (for [k [a] v b] [k v])) '([0 (0 1)] [3 (1 2)]))
([0 0] [0 1] [3 1] [3 2])
(let [{:keys [a], :strs [b], :syms [c]} {:a 1, "b" 2, 'c 3}] [a b c])
[1 2 3]
((fn [& {a :a, c :b, :as m}] (prn a c m)) :a 1 :b 2 :c 3)
nil
"1 2 {:a 1, :b 2, :c 3}\n"
(doseq [{a :a, b :b} [(atom {:a 0, :b 1}) (atom {:a 2, :b 3})]] (println a b))
nil
"nil nil\nnil nil\n"
((fn f ([l] (apply f l)) ([a b c] :no-d) ([a b c d] d)) [1 2 3])
:no-d
(let [[a b c :as d :as e] [1 2 3 4 [5 6]]] [a b c d])
[1 2 3 [1 2 3 4 [5 6]]]
(let [{:keys [a b], [c] :c} {:a 1, :b 2, :c [3 4 5]}] [a b c])
[1 2 3]
((fn [a b & c] (println "a" a "b" b "c" c)) 1 2 3 4 5 6)
nil
"a 1 b 2 c (3 4 5 6)\n"
(for [[a b c] (map vector (range) [:foo :bar :baz] "hahaha foo")] {:a a, :b b, :see c})
({:a 0, :b :foo, :see \h} {:a 1, :b :bar, :see \a} {:a 2, :b :baz, :see \h})
(apply (fn [& {:keys [a b]}] [:a a :b b]) (mapcat identity {:a 1, :b 2, :c 3}))
[:a 1 :b 2]
(letfn [(foo [a b & rest] (apply + a b rest))] (foo 1 2 3 4 5 6))
21
(for [[k v] {:foo "jams", 12 15}] (str "I have a " k " and a " v))
("I have a :foo and a jams" "I have a 12 and a 15")
(some (fn [[a b]] (when (odd? b) a)) (partition 2 1 [2 4 6 8 9 10 11]))
8
(defn foo [a b & {:keys [x y z], :or {z 88}}] (prn a b x y z))
#'user/foo
(let [a (atom 0) o (reify Object (toString [this] (swap! a inc) (str @a)))] [(str o) (str o)])
["1" "2"]
(let [a (atom '[x [y z]])] [(first (swap! a (fn [[_ [f & more]]] [f more]))) @a])
[y [y (z)]]
(for [[[a a1] [b b1]] (partition 2 1 [[1 2] [3 4]])] [(- a b) (- a1 b1)])
([-2 -2])
(let [a (atom 0)] (clojure.walk/postwalk (fn [x] (swap! a inc) x) '(dotimes [i 5] (println "Hello"))) @a)
8
(let [f (fn [a b c] [c b a])] [(f 1 2 3) (apply f 1 [2 3])])
[[3 2 1] [3 2 1]]
(let [maps [{:a 1, :b 2} {:x 5, :y 6}] [{:keys [a b]}] maps] [a b])
[1 2]
(defmacro m [var-name] (comment “var-name is a symbol how do I get a var in the right namespace?“))
#'user/m
(letfn [(bar ([a b] nil) ([a] (recurr nil nil))) (recurr [& args] (apply bar args))] (def bar bar))
#'user/bar
(let [a [1 2 3] z (map long a) [_ ^:long b] z] (= b 2))
true
(let [{:keys [a b], d :c, :as e} {:a 1, :b 2, :c 3}] [a b d e])
[1 2 3 {:a 1, :b 2, :c 3}]
(let [a 5] `(* 1 2 ~a))
(clojure.core/* 1 2 5)
(do (require 'clojure.walk) (clojure.walk/macroexpand-all ''(-> a b)))
(quote (b a))
(some #{'a} '(a b c d))
a
(defn herp [derp] (str "herp a " derp))
#'user/herp
(str '(this is a random list \a))
"(this is a random list \\a)"
(class (partition 2 '[a b c d]))
clojure.lang.LazySeq
(vec (concat '[a b] '[c d]))
[a b c d]
(let [q ['(a b) '()]] (first q))
(a b)
(macroexpand '(->> a b (->> c d)))
(b a (d c))
(keys (apply hash-map '(a 2 b 7)))
(a b)
(let* [a 1] (-> 1 inc (* 2)))
4
(prn (class (re-seq #"(a)(s)d" "asdf")))
nil
"clojure.lang.Cons\n"
(clojure.walk/macroexpand-all '(doto a (b 1) (c 2)))
(clojure.core/let [G__3286870 a] (b G__3286870 1) (c G__3286870 2) G__3286870)
(str "It was only" " a flesh wound!")
"It was only a flesh wound!"
(defn foo [str & {:keys [a b c]}])
#'user/foo
(def x (atom '(a b c d)))
#'user/x
(with-in-str "(foo blah a list)" (read))
nil
(let [a 'some-symbol] `(let [~a 1] ...))
(clojure.core/let [some-symbol 1] user/...)
(or "write a program to write the program")
"write a program to write the program"
(macroexpand-1 '(proxy [java.util.Comparator] [] (compare [a b] 0)))
(clojure.core/proxy* (quote (proxy [java.util.Comparator] [] (compare [a b] 0))) java.util.Comparator [] {(quote compare) (fn ([this a b] 0))})
('b '{a 1, b 2, c 3})
2
('c (set '(a b c d e)))
c
(def a (with-meta {:notation [:a]} {:safe-squares [1 2]}))
#'user/a
(def a {:a 0, :b [1 2 3]})
#'user/a