(defn print-hello [nome] (print "Digo olá a " nome) (str "Olá " nome))
#'user/print-hello
(defmacro mac [& a] `(loop [forms# '~a] (let [f# (first forms#)] f#)))
#'user/mac
(let [not-number #_(+ 1 2 (* 3 5)) "is a string"] not-number)
"is a string"
(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])
(let* [map__2207 {:b 2} a (clojure.core/get map__2207 :a 1) b (clojure.core/get map__2207 :b)])
nil
(binding [*print-dup* true] (-> '(defrecord Foo [^int a b c]) macroexpand-1 pr-str))
"(clojure.core/defrecord Foo [^int a b c])"
(sort (comparator (fn [a b] (if (> (count a) (count b)) nil #(let [x (sort (list % %2))] (if (.equals (first x) %) 1 -1))))) ["a" "booc" "aood" "b"])
("b" "a" "aood" "booc")
(let [{:keys [a b c], {:keys [e f g]} :d} {:a 0, :b 1, :c 2, :d {:e 3, :f 4, :g 5}}] [a b c e f g])
[0 1 2 3 4 5]
(reduce (fn [x y] (let [a (get x 1) b (get y 1)] (if (neg? (compare a b)) x y))) [["Coke" "16" ""] ["Coke" "35" "3"] ["Coke" "2" "3"]])
["Coke" "16" ""]
(let [a #(apply str (flatten %)) r repeatedly n #(rand-nth %&) w (fn [] (let [b (n "!" "..." "." "" "" "" "") s [(n "S" "Z" "T" "K" "N" "Th" "Sh" "Y" "P" "K" "L" "G" "Ny" "Ft" "Cth") (r (n 1 2) #(vector (n "a" "i" "o" "e" "ia" "u" "ai") (n "" "" "" "-" "'") (n "l" "h" "s" "pr" "t" "rl" "n" "k" "gl" "g" "gh" "ts" "lt" "gr" "rk" "kh" "x" "sh" "ng"))) (n "urr" "ato" "omkur" "iashi" "oroth" "okh" "yng" "otep" "ilal" "ugu" "" "")]] [b " " (if (seq b) s (.toLowerCase (a s)))]))] (re-find #"[A-Z].+" (a (r 200 w))))
"Liarki'rlurr. Pe-shiaglilal gerlokh! Shurkomkur nyiarke'xato... Ki-rkapromkur fta-ginugu. Thelilal ketsolomkur poprai'shugu! Shosiashi so't laigugu. Yigrikhurr la-xial nyu-prokh! Porli-hyng cthonugu cthia'rlailotep niashiah! Ne-ga'lyng. Nipriakokh so'hotep! Cthulato ctha'ltia-lt shanototep nihe'kh. Ga-gha-gl ke'n... Nirkiashi ge'xaiprokh gigokh laigrikurr! Nyiltugu... Koxurr cthialtu-pr sairlatil...
(defn remove-from-vector "Takes a vector and an index, returns a vector with the member at that index removed." [vc indx] (vec (concat (subvec vc (inc indx)) (subvec vc 0 indx))))
#'user/remove-from-vector
((fn fib ([n] (if (< 2 n) (fib (- n 2) 1 1) 1)) ([n a b] (if (<= n 0) b (recur (dec n) b (+ a b))))) 10)
55
(letfn [(parse-fraction [xs] (let [[m n] (reduce (fn [[a b] x] [(+ x (* a 10)) (* b 10)]) [0 1.0] xs)] (/ m n)))] (parse-fraction [1 2 3 4]))
0.1234
(println (format "%cACTION%c slaps around antifuchs with a large trout" (char 1) (char 1)))
nil
"ACTION slaps around antifuchs with a large trout\n"
(map vector '[a b c] '[1 2 3] '[e f g])
([a 1 e] [b 2 f] [c 3 g])
(map list '(1 2 3) '(a b c) '(u v s))
((1 a u) (2 b v) (3 c s))
(defn test [#^"[[Ljava.lang.Long;" x] (loop [a (long 0)] (recur (aget x 1 1))))
#'user/test
(macroexpand `(let [[& {:keys [b a], :or {b @a}}] [:a (atom 5)]] b))
(clojure.core/let [[& {:keys [user/b user/a], :or {user/b (clojure.core/deref user/a)}}] [:a (clojure.core/atom 5)]] user/b)
(let [ks '(a b c)] (zipmap ks (map #(str % "val") ks)))
{a "aval", b "bval", c "cval"}
(defmacro my-or [f a vs] (cons 'or (for [v vs] `(= ~a ~v))))
#'user/my-or
(let [L (with-meta (map identity '(a b)) {:foo :bar})] (meta (conj L 'c)))
nil
(concat '(A) (repeat 10 'very) '(Happy New Year to Clojure community :D!))
(A very very very very very very very very very very Happy New Year to Clojure community :D!)
(defmacro flipper [f & a] `(fn [& args#] (apply ~f (concat args# ~a))))
#'user/flipper
(remove #(contains? '#{a b nil Double/NaN} %) ['a 'b 'c nil Double/NaN])
(c ##NaN)
(let [form '(print a)] (for [x (range 3)] `(let [~'a ~x] ~form)))
((clojure.core/let [a 0] (print a)) (clojure.core/let [a 1] (print a)) (clojure.core/let [a 2] (print a)))
(apply conj {} (map #(vector % (str % "_val")) '(a b c d)))
{a "a_val", b "b_val", c "c_val", d "d_val"}
(map list '(1 2 3) '(a b c) '(z y x))
((1 a z) (2 b y) (3 c x))
(let [{:keys [a b c :a all]} {:a 0, :b 1, :c 2}] all)
nil
(macroexpand '(let [[x y] [1 2]] {:keys [a b]} {:a 1, :b 2}))
(let [[x y] [1 2]] {:keys [a b]} {:a 1, :b 2})
(let [cmd '(f a b)] `(~(first cmd) x# ~@(next cmd)))
(f x__3459776__auto__ a b)
(map #(hash-map :a %1 :b %2) [1 2 3] '[a b c])
({:a 1, :b a} {:a 2, :b b} {:a 3, :b c})
(let [{:keys [a b c], :as m} {:a 1, :b 2, :c 3}] m)
{:a 1, :b 2, :c 3}
(map str '(1 2 3) '(a b c) '(z y x))
("1az" "2by" "3cx")
(do (defrecord trec [a b c]) (let [q (trec. 1 2 3)] (keys q)))
(:a :b :c)
(let [b 2] `(let [a 1] `(blah blah ~a blah ~~b blah)))
(clojure.core/let [user/a 1] (clojure.core/sequence (clojure.core/seq (clojure.core/concat (clojure.core/list (quote user/blah)) (clojure.core/list (quote user/blah)) (clojure.core/list user/a) (clojure.core/list (quote user/blah)) (clojure.core/list 2) (clojure.core/list (quote user/blah))))))
(let [body '(a b)] `(do ~@(for [b body] `(print ~b))))
(do (clojure.core/print a) (clojure.core/print b))
(str "Your mother was a hamster and your father smelt of elderberries, " "core.async")
"Your mother was a hamster and your father smelt of elderberries, core.async"
(let [fn-name 'tompkins] `(do (defmulti ~fn-name [a b c] (+ 1 2 3))))
(do (clojure.core/defmulti tompkins [user/a user/b user/c] (clojure.core/+ 1 2 3)))
(let [x '[a b c d e]] (->> x count rand-int (nth x)))
c
((fn [& [a b c :as args]] (let [defaults [1 2 3] bindings (map #(or % %2) (concat args (repeat nil)) defaults) [a b c] bindings] bindings)) 42 43)
(42 43 3)
(let [list '(a b c d)] (partition 2 1 (cons (last list) list)))
((d a) (a b) (b c) (c d))
(let [{:keys [a b c :as all]} {:a 0, :b 1, :c 2}] all)
nil
(map (fn [b a] (assoc a 2 (get b 2))) [[1 2 100] [1 2 100] [1 2 100]] [[4 5 200] [4 6 100] [4 7 200]])
([4 5 100] [4 6 100] [4 7 100])
(map (fn [a b] (assoc a 2 (get b 2))) [[1 2 100] [1 2 100] [1 2 100]] [[4 5 200] [4 6 100] [4 7 200]])
([1 2 200] [1 2 100] [1 2 200])
(map (juxt list? seq?) ['(a b c) (list 1 2 3) [1 2 3]])
([true true] [true true] [false false])
(let [[a b :as all] [1 2 3 4]] {:a a, :b b, :all all})
{:a 1, :all [1 2 3 4], :b 2}
(str "I'd like " (map (fn [fruit] str " a " fruit) ["apple" "pear" "banana"]))
"I'd like clojure.lang.LazySeq@83d78478"
(flatten (map (fn [[x y]] y) '(["x" (a b c)] ["y" (d e f)])))
(a b c d e f)
(do (defrecord R [a b]) (let [r (->R :x :y)] (= r (read-string (pr-str r)))))
true
(remove #(= true %) '(a b true c true d e f true))
(a b c d e f)