Macros that can be used in an expression thread.
Macros that can be used in an expression thread.
(--> & forms)Similar to clojure.core/->, with added symbol macros for the
various threading macros found in pallet.thread-expr. Currently
supported symbol macros are:
binding
for
let
when, when-not, when-let
if, if-not
apply
expose-request-as (bound to pallet.thread-expr/arg->
Examples:
(--> 5 (let [y 1] (for [x (range 3)] (+ x y))) (+ 1)) => 12
(--> 5
(expose-request-as [x] (+ x))
(+ 1))
=> 11
Similar to `clojure.core/->`, with added symbol macros for the
various threading macros found in `pallet.thread-expr`. Currently
supported symbol macros are:
* binding
* for
* let
* when, when-not, when-let
* if, if-not
* apply
* expose-request-as (bound to `pallet.thread-expr/arg->`
Examples:
(--> 5
(let [y 1]
(for [x (range 3)]
(+ x y)))
(+ 1))
=> 12
(--> 5
(expose-request-as [x] (+ x))
(+ 1))
=> 11(-->> & forms)Similar to clojure.core/->>, with added symbol macros for the
various threading macros found in pallet.thread-expr. Currently
supported symbol macros are:
binding
for
let
when, when-not, when-let
if, if-not
apply
expose-request-as (bound to pallet.thread-expr/arg->>
Examples:
(-->> 5 (let [y 1] (for [x (range 3)] (+ x y))) (+ 1)) => 12
(-->> 5
(expose-request-as [x] (+ x))
(+ 1))
=> 11
Similar to `clojure.core/->>`, with added symbol macros for the
various threading macros found in `pallet.thread-expr`. Currently
supported symbol macros are:
* binding
* for
* let
* when, when-not, when-let
* if, if-not
* apply
* expose-request-as (bound to `pallet.thread-expr/arg->>`
Examples:
(-->> 5
(let [y 1]
(for [x (range 3)]
(+ x y)))
(+ 1))
=> 12
(-->> 5
(expose-request-as [x] (+ x))
(+ 1))
=> 11(apply-> arg f & arg-coll)Apply in a threaded expression. e.g. (-> 1 (apply-> + [1 2 3])) => 7
Apply in a threaded expression.
e.g.
(-> 1
(apply-> + [1 2 3]))
=> 7(apply->> f & arg-coll)Apply in a threaded expression. e.g. (->> 1 (apply->> + [1 2 3])) => 7
Apply in a threaded expression.
e.g.
(->> 1
(apply->> + [1 2 3]))
=> 7(apply-map-> arg f & arg-coll)Apply in a threaded expression. e.g. (-> :a (apply-map-> hash-map 1 {:b 2})) => {:a 1 :b 2}
Apply in a threaded expression.
e.g.
(-> :a
(apply-map-> hash-map 1 {:b 2}))
=> {:a 1 :b 2}(apply-map->> f & arg-coll)Apply in a threaded expression. e.g. (->> :a (apply-map->> hash-map 1 {:b 2})) => {:a 1 :b 2}
Apply in a threaded expression.
e.g.
(->> :a
(apply-map->> hash-map 1 {:b 2}))
=> {:a 1 :b 2}(arg-> arg [sym] & body)Lexically assign the threaded argument to the specified symbol.
(-> 1 (arg-> [x] (+ x)))
=> 2
Lexically assign the threaded argument to the specified symbol. (-> 1 (arg-> [x] (+ x))) => 2
(arg->> [sym] & body)Lexically assign the threaded argument to the specified symbol.
(->> 1 (arg->> [x] (+ x)))
=> 2
Lexically assign the threaded argument to the specified symbol. (->> 1 (arg->> [x] (+ x))) => 2
(binding-> arg bindings & body)A binding form that can appear in a request thread.
eg.
(def a 0)
(-> 1
(binding-> [a 1]
(+ a)))
=> 2
A `binding` form that can appear in a request thread.
eg.
(def *a* 0)
(-> 1
(binding-> [*a* 1]
(+ *a*)))
=> 2(binding->> bindings & body)A binding form that can appear in a request thread.
eg.
(def a 0)
(->> 1
(binding->> [a 1]
(+ a)))
=> 2
A `binding` form that can appear in a request thread.
eg.
(def *a* 0)
(->> 1
(binding->> [*a* 1]
(+ *a*)))
=> 2(for-> arg seq-exprs & body)Apply a thread expression to a sequence. eg. (-> 1 (for-> [x [1 2 3]] (+ x))) => 7
Apply a thread expression to a sequence.
eg.
(-> 1
(for-> [x [1 2 3]]
(+ x)))
=> 7(for->> seq-exprs & body)Apply a thread expression to a sequence. eg. (->> 1 (for->> [x [1 2 3]] (+ x))) => 7
Apply a thread expression to a sequence.
eg.
(->> 1
(for->> [x [1 2 3]]
(+ x)))
=> 7(if-> arg condition form)(if-> arg condition form else-form)An if form that can appear in a request thread
eg.
(-> 1
(if-> true
(+ 1)
(+ 2)))
=> 2
An `if` form that can appear in a request thread
eg.
(-> 1
(if-> true
(+ 1)
(+ 2)))
=> 2(if->> condition form arg)(if->> condition form else-form arg)An if form that can appear in a request thread
eg.
(->> 1
(if->> true
(+ 1)
(+ 2)))
=> 2
An `if` form that can appear in a request thread
eg.
(->> 1
(if->> true
(+ 1)
(+ 2)))
=> 2(if-not-> arg condition form)(if-not-> arg condition form else-form)An if-not form that can appear in a request thread
eg.
(-> 1
(if-not-> true
(+ 1)
(+ 2)))
=> 3
An `if-not` form that can appear in a request thread
eg.
(-> 1
(if-not-> true
(+ 1)
(+ 2)))
=> 3(if-not->> condition form arg)(if-not->> condition form else-form arg)An if-not form that can appear in a request thread
eg.
(->> 1
(if-not->> true
(+ 1)
(+ 2)))
=> 3
An `if-not` form that can appear in a request thread
eg.
(->> 1
(if-not->> true
(+ 1)
(+ 2)))
=> 3(let-> arg binding & body)A let form that can appear in a request thread.
eg.
(-> 1
(let-> [a 1]
(+ a)))
=> 2
A `let` form that can appear in a request thread.
eg.
(-> 1
(let-> [a 1]
(+ a)))
=> 2(let->> binding & body)A let form that can appear in a request thread.
eg.
(->> 1
(let->> [a 1]
(+ a)))
=> 2
A `let` form that can appear in a request thread.
eg.
(->> 1
(let->> [a 1]
(+ a)))
=> 2(let-with-arg-> arg arg-symbol binding & body)A let form that can appear in a request thread, and assign the
value of the threaded arg.
eg. (-> 1 (let-with-arg-> val [a 1] (+ a val))) => 3
A `let` form that can appear in a request thread, and assign the
value of the threaded arg.
eg.
(-> 1
(let-with-arg-> val [a 1]
(+ a val)))
=> 3(let-with-arg->> arg-symbol binding & body)A let form that can appear in a request thread, and assign the
value of the threaded arg.
eg. (->> 1 (let-with-arg->> val [a 1] (+ a val))) => 3
A `let` form that can appear in a request thread, and assign the
value of the threaded arg.
eg.
(->> 1
(let-with-arg->> val [a 1]
(+ a val)))
=> 3(when-> arg condition & body)A when form that can appear in a request thread.
eg.
(-> 1
(when-> true
(+ 1)))
=> 2
A `when` form that can appear in a request thread.
eg.
(-> 1
(when-> true
(+ 1)))
=> 2(when->> condition & body)A when form that can appear in a request thread.
eg.
(->> 1
(when->> true
(+ 1)))
=> 2
A `when` form that can appear in a request thread.
eg.
(->> 1
(when->> true
(+ 1)))
=> 2(when-let-> arg binding & body)A when-let form that can appear in a request thread.
eg.
(-> 1
(when-let-> [a 1]
(+ a)))
=> 2
A `when-let` form that can appear in a request thread.
eg.
(-> 1
(when-let-> [a 1]
(+ a)))
=> 2(when-let->> binding & body)A when-let form that can appear in a request thread.
eg.
(->> 1
(when-let->> [a 1]
(+ a)))
=> 2
A `when-let` form that can appear in a request thread.
eg.
(->> 1
(when-let->> [a 1]
(+ a)))
=> 2(when-not-> arg condition & body)A when-not form that can appear in a request thread.
eg.
(-> 1
(when-not-> true
(+ 1)))
=> 1
A `when-not` form that can appear in a request thread.
eg.
(-> 1
(when-not-> true
(+ 1)))
=> 1(when-not->> condition & body)A when-not form that can appear in a request thread.
eg.
(->> 1
(when-not->> true
(+ 1)))
=> 1
A `when-not` form that can appear in a request thread.
eg.
(->> 1
(when-not->> true
(+ 1)))
=> 1cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |