Re: lazy-let & loop
Sam Steingold <[email protected]>
| Newsgroups | gmane.lisp.clisp.devel |
|---|---|
| Message-ID | <[email protected]> |
> * <[email protected]> [2017-12-20 18:16:08 +0000]: > > 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. This is a proof of concept. If we can fix all the LOOP bugs (search for #-CLISP in loop.tst) using lazy-let, it would lend support to my TAGLET proposal: (taglet (vars) &body) == (lazy-let (vars) (tagbody ,@body)) TAGLET fits the way LOOP is generally _perceived_ very well. > Actually, it has huge costs in clisp - try out DISASSEMBLE - as the > closures are not inlined. Inlining the flet closures has been in clisp man page TODO section as long as I can remember. ;-) Thanks. -- Sam Steingold (http://sds.podval.org/) on darwin Ns 10.3.1504 http://steingoldpsychology.com http://www.childpsy.net https://jihadwatch.org http://mideasttruth.com http://americancensorship.org http://memri.org When told to go to hell, ask for directions. ------------------------------------------------------------------------------ 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