(->>doto & forms)
used to perform side effects within a ->>
macro
(->> [1 2 3] (->>doto (map inc) print) (cons 0)) ;; (2 3 4) => [0 1 2 3]
used to perform side effects within a `->>` macro (->> [1 2 3] (->>doto (map inc) print) (cons 0)) ;; (2 3 4) => [0 1 2 3]
(->doto x & forms)
used to perform side-effects within a ->
macro
(-> {:a 1} (->doto (update-in [:a] inc) print) (assoc :b 2)) ;; {:a 2} => {:a 1, :b 2}
used to perform side-effects within a `->` macro (-> {:a 1} (->doto (update-in [:a] inc) print) (assoc :b 2)) ;; {:a 2} => {:a 1, :b 2}
(->prn x)
(->prn x tag)
used to print within the macro
(-> [1 2 3] (->prn) (conj 4)) ;; [1 2 3] => [1 2 3 4]
used to print within the macro (-> [1 2 3] (->prn) (conj 4)) ;; [1 2 3] => [1 2 3 4]
(dbg-> n & funcs)
prints each stage of the ->
macro
(-> (dbg-> {:a 1}
(assoc :b 2)
(merge {:c 3}))
(with-out-str)
(string/split-lines))
=> ["" ""
"{:a 1}"
"-> (assoc :b 2) :: {:a 1, :b 2}"
"-> (merge {:c 3}) :: {:a 1, :b 2, :c 3}"]
prints each stage of the `->` macro (-> (dbg-> {:a 1} (assoc :b 2) (merge {:c 3})) (with-out-str) (string/split-lines)) => ["" "" "{:a 1}" "-> (assoc :b 2) :: {:a 1, :b 2}" "-> (merge {:c 3}) :: {:a 1, :b 2, :c 3}"]
(dbg->> n & funcs)
prints each stage of the ->>
macro
(-> (dbg->> (range 5) (map inc) (take 2)) (with-out-str) (string/split-lines)) => ["" "" "(0 1 2 3 4)" "->> (map inc) :: (1 2 3 4 5)" "->> (take 2) :: (1 2)"]
prints each stage of the `->>` macro (-> (dbg->> (range 5) (map inc) (take 2)) (with-out-str) (string/split-lines)) => ["" "" "(0 1 2 3 4)" "->> (map inc) :: (1 2 3 4 5)" "->> (take 2) :: (1 2)"]
(dbg-print form arrow)
creates the form for debug print
(dbg-print '(+ 1 2 3) '->) => '((lucid.core.debug/wrap-print + (quote (+ 1 2 3)) (quote ->)) 1 2 3)
creates the form for debug print (dbg-print '(+ 1 2 3) '->) => '((lucid.core.debug/wrap-print + (quote (+ 1 2 3)) (quote ->)) 1 2 3)
(wrap-print f expr arrow)
wraps a function in a println
statement'
((lucid.core.debug/wrap-print + (quote (+ 1 2 3)) (quote ->)) 1 2 3) => 6
(with-out-str ((lucid.core.debug/wrap-print + (quote (+ 1 2 3)) (quote ->)) 1 2 3)) => "-> (+ 1 2 3) :: 6"
wraps a function in a `println` statement' ((lucid.core.debug/wrap-print + (quote (+ 1 2 3)) (quote ->)) 1 2 3) => 6 (with-out-str ((lucid.core.debug/wrap-print + (quote (+ 1 2 3)) (quote ->)) 1 2 3)) => "-> (+ 1 2 3) :: 6"
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close