Arc Forumnew | comments | leaders | submitlogin
1 point by byronsalty 5916 days ago | link | parent

So I had to see PG's solution in arc1. Pretty nice as it removes some duplication and has a simpler (and more efficient) way to determine if a sub aif is needed:

  (mac aif (expr . body)
     `(let it ,expr
       (if it
           ,@(if (cddr body)
                 `(,(car body) (aif ,@(cdr body)))
                 body))))
Duplication is removed by simple branching inside the `(let it ,expr ... part. And (cddr body) is shorter and more efficient than (<= (len body) 2).