Subject: Re: SETF and variable issues in Self Similar program.
From: rpw3@rpw3.org (Rob Warnock)
Date: Tue, 11 Dec 2007 19:34:19 -0600
Newsgroups: comp.lang.lisp
Message-ID: <Yv6dndrKTqkGp8LanZ2dnUVZ_rKtnZ2d@speakeasy.net>
Eric  <ericbelcastro@gmail.com> wrote:
+---------------
| Since your conversation brings up the issue, and since I am studying
| the LOOP macro, is APPEND as a LOOP command (within the LOOP body) as
| inefficient as APPEND in its normal sense outside of the LOOP macro?
+---------------

Probably not *quite* as inefficient, since most LOOP implementations
will cache a pointer to the tail of the result list being accumulated,
but some inefficiencies will still remain, since in the presence of
conditionals LOOP's APPEND has no way of knowing that a given list
being appended is going to be the "last" such piece, and thus will
COPY-LIST the last piece unnecessarily. And of course, it will also
have to copy all the earlier pieces as well. [Normal APPEND semantics.]

Using the NCONC keyword, when feasible, should save that copying.


-Rob

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