Skip to content

clojure.core/->

View this page on ClojureDocs

Type: macro Added: Clojure 1.0 Examples: 9 Runnable: 4
([x & forms])

Threads the expr 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.

Examples

by zk on
by na_ka_na on . May have evaluation errors.
by BertrandDechoux on
by arathunku on
by expert0226 on . May have evaluation errors.
by eggsyntax on . May have evaluation errors.
by rafmagana on . May have evaluation errors.
by rafmagana on . May have evaluation errors.
by MokkeMeguru on

Note by steveminer

See also ->> which is similar but threads the first expr as the last argument of the forms.

Note by John Wang

I have a short blog on this, in case you are still confused on it and understand Chinese.

Note by phreed

Can be used as an alternative to get-in.

See also


Content from the matching ClojureDocs page, with authors credited on each contribution.