Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (defmacro accum-uniq (f &body body)
- (let ((f (if (consp f) f (list f))))
- `(let (#1=#:acc)
- (flet ((,(car f) (#2=#:val) (pushnew #2# #1# ,@(cdr f))))
- ,@body)
- #1#)))
- (accum-uniq (a :test #'string=)
- (dotimes (i 100)
- (a (write-to-string (random 10)))))
- ;-> ("8" "0" "6" "2" "4" "5" "9" "7" "3" "1")
Add Comment
Please, Sign In to add comment