Macro `->`
Method chaining, also known as named parameter idiom, is a common syntax for invoking multiple method calls in object-oriented programming languages. Each method returns an object, allowing the calls to be chained together in a single statement.
In Clojure, macro ->
is interesting to implement method chaining.
Let’s try to express 10 days ago
!
Which is exactly the same as:
How about lein new app
:
Express html node action:
Clojure Doc
->
macro
Usage: (-> 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.
Added in Clojure version 1.0