(mac >> body
`(let it ,(car body)
,(if (cdr body) `(>> ,@(cdr body))
'it)))
It works a little bit like CL's let* but is anaphoric and it's much easier to read. It's a pipeline: each expression is evaluated and it is bound to the result for the next expression to use. Example:
It's very convenient sometimes. Plus, since most of Arc's functions have their main argument at the end (thanks devteam!) it could be modified so that it appends "it" to every expression in the body. This depends on how it's used in the real world.
(def ablast (l)
(if (no (cdr l))
nil
(cons (car l) (ablast (cdr l)))))
(def replc (x y l)
(if (atom l) (if (is x l) y l)
(no l) nil
(is x (car l)) (cons y (replc x y (cdr l)))
(acons (car l)) (cons (replc x y (car l)) (replc x y (cdr l)))
(cons (car l) (replc x y (cdr l)))))
(mac imp body
(if (no body) nil
(replc 'it `(imp ,@(ablast body)) (last body))))