Syntax threading macros.

Primary

In this section: as->

as→

Available since version 1.0 (alias of clojure.core/as→)

MACRO (as-> expr name & forms)

Binds name to expr, evaluates the first form in the lexical context of that binding, then binds name to that result, repeating for each successive form, returning the result of the last form.

Second

In this section: -> cond-> some->

Available since version 1.0 (alias of clojure.core/→)

MACRO (-> x & forms)

Threads the expr x through the forms. Inserts x as the second item in the first form, making a list of it if it is not a list already. If there are more forms, inserts the first form as the second item in second form, etc.

See also: ->>

cond→

Available since version 1.0 (alias of clojure.core/cond→)

MACRO (cond-> expr & clauses)

Takes an expression and a set of test/form pairs. Threads expr (via ->) through each form for which the corresponding test expression is logically true.

Unlike cond branching, cond-> threading does not short circuit after the first true test expression.

See also: cond->>

some→

Available since version 1.0 (alias of clojure.core/some→)

MACRO (some-> expr & forms)

When expr is not nil, threads it into the first form (via ->), and when that result is not nil, through the next etc.

See also: some->>

Last

In this section: ->> cond->> some->>

→>

Available since version 1.0 (alias of clojure.core/→>)

MACRO (->> x & forms)

Threads the expr x through the forms. Inserts x as the last item in the first form, making a list of it if it is not a list already. If there are more forms, inserts the first form as the last item in second form, etc.

See also: ->

cond→>

Available since version 1.0 (alias of clojure.core/cond→>)

MACRO (cond->> expr & clauses)

Takes an expression and a set of test/form pairs. Threads expr (via ->>) through each form for which the corresponding test expression is logically true.

Unlike cond branching, cond->> threading does not short circuit after the first true test expression.

See also: cond->

some→>

Available since version 1.0 (alias of clojure.core/some→>)

MACRO (some->> expr & forms)

When expr is not nil, threads it into the first form (via ->>), and when that result is not nil, through the next etc.

See also: some->