Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (defmacro lazy (&body body)
- (let ((forced (gensym))
- (value (gensym)))
- '(let ((,forced nil)
- (,value nil))
- (lambda ()
- (unless ,forced
- (setf ,value (progn ,@body))
- (setf ,forced t))
- ,value))))
Add Comment
Please, Sign In to add comment