| iflet only binds its var to the first expr if it's true. This macro, like aif, will bind to whichever expr happens to be true: (mac rif (var expr . body)
`(let ,var ,expr
(if ,var
,@(if (cddr body)
`(,(car body) (rif ,var ,@(cdr body)))
body))))
Since it's a more general aif, you can consolidate code by redefining aif in terms of rif: (mac aif (expr . body)
`(rif it ,expr ,@body))
The name was inspired by rfn, which is to afn as rif is to aif. |