Created
July 17, 2020 15:33
-
-
Save lukego/1714405ba893250812bf522a1e4f1b97 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defmacro collecting (&body body) | |
"Evaluate BODY and return the list of values accumulated by calls to COLLECT." | |
(with-unique-names (collector) | |
`(progn (sb-int:collect ((,collector)) | |
(flet ((collect (x) (,collector x))) | |
,@body) | |
(,collector))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment