| Newsgroups |
gmane.lisp.clisp.devel |
| Message-ID |
<bcb4758d55a942589237ba97c061e7a4@HE105658.emea1.cds.t-internal.com> |
Hi again,
Having fun, here's the version with the need for most gensyms removed:
(defmacro lazy-let1 ((var) &body body)
(let ((shadow (gensym (symbol-name var))))
`(let ((,shadow 'unbound))
(flet ((,shadow () (if (eq ,shadow 'unbound) ,var ,shadow))
((setf ,shadow) (,var) (setf ,shadow ,var)))
(symbol-macrolet ((,var (,shadow))) .,body)))))
(setf ,shadow) is indeed defined as (setf ,shadow) - scoping rules!
'unbound should be replaced by the usual unique CONS trick, and perhaps #1#...
This is just for the fun, I don't like this macro because of the run-time check.
Actually, it has huge costs in clisp - try out DISASSEMBLE - as the closures are not inlined.
Regards,
Jörg
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
clisp-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/clisp-devel