Subject: Re: (setf (getf ... and list of plists
From: rpw3@rpw3.org (Rob Warnock)
Date: Sat, 28 Jul 2007 03:18:15 -0500
Newsgroups: comp.lang.lisp
Message-ID: <xOOdnbyHGNxaZjfbnZ2dnUVZ_jqdnZ2d@speakeasy.net>
Kent M Pitman  <pitman@nhplace.com> wrote:
+---------------
| [(SETF (GETF ...) ...) is ] approximately defined [it doesn't do it
| this way, but it will be easiest to understand this way, I think] as:
|  (defmacro setf-of-getf (place indicator value) ;APPROXIMATE ONLY
|    `(let ((place-value ,place)
|           (indicator ,indicator)
|           (value ,value))
|       (loop for (ind . tail) on place-value
|             when (eq ind indicator)
|               do (return (setf (car tail) value))
|             finally 
|               (progn (setf ,place (list* indicator value place-value))))))
+---------------

Uh... shouldn't that LOOP/FOR clause have a BY #'CDDR on it? That is:

        (loop for (ind . tail) on place-value by #'cddr
	      when (eq ind indicator)
		...
	      ... )

Yes, I know you said "APPROXIMATE ONLY", but if he tries to manually
walk it through, OP might get confused without the BY #'CDDR.


-Rob

-----
Rob Warnock			<rpw3@rpw3.org>
627 26th Avenue			<URL:http://rpw3.org/>
San Mateo, CA 94403		(650)572-2607