Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (defmacro reducing (rf &body body)
- (destructuring-bind ((&rest b0) (a1 &rest b1) (a2 &rest b2)) body
- (with-gensyms (result input resultp inputp)
- `(flet (,(when (typep rf '(or symbol list))
- `(,rf (&rest args) (apply ,rf args))))
- (lambda (&optional (,result nil ,resultp) (,input nil ,inputp))
- (declare (optimize speed (debug 0) (safety 0)))
- (block nil
- (cond (,inputp (let ((,(car a2) ,result)
- (,(cadr a2) ,input))
- ,@b2))
- (,resultp (let ((,(car a1) ,result))
- ,@b1))
- (t ,@b0))))))))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement