github repo
This library provides a single macro called
pipe
.
(pipe <variable> <expressions> ...)
<variable>
is bound to the result of the first expression.
Then it gets bound, in order, to the result of each additional expression.
The result of the last expression is returned.
For example:
(pipe _
"Hello!"
(string->list _)
(map char->integer _)
(map number->string _)
(write _))
...is equivalent to...
(let* ((_ "Hello!")
(_ (string->list _))
(_ (map char->integer _))
(_ (map number->string _)))
(write _))
(pipe)
(pipe it)
(pipe it expression)
(pipe it first-expression last-expression)
(pipe it first-expression . rest-expressions)