(-> ..args) args: one or more forms
Alternative syntax for nested function calls.
-> macro performs a simple syntactic transformation on its arguments.
(-> a (b 1) (c 2)) is equivalent to:
(do (let first a) (let second (b first 1)) (c second 2))
In other words, the first argument can be any form, and subsequent arguments must all represent function calls. The result of evaluating each form is inserted as the first argument to its succeeding function call. Then, the result of the final function call is returned.
It's not always convenient to write out each function call in full. As such,
performs the following syntax transformations on its second and subsequent arguments:
- The symbol
Finally, if a function call is prefixed with
.., the result of the previous
call is splayed when it's passed in as the function's first argument:
..(a c) implies
(a ..x c) rather than
(a x c).