[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

&REST lists

[Common-Lisp removed; I can't bear to be heard by such multitudes.
 CL-Cleanup added.]

    Date: Mon, 4 Jan 1988  20:27 EST
    From: "Scott E. Fahlman" <Fahlman@C.CS.CMU.EDU>

	Is there general agreement on whether it is valid Common Lisp to
	destructively modify (RPLACA, RPLACD) the list to which a &REST
	parameter is bound?  I can't find a reference in CLtL for this.

    I think there's general agreement that &rest args are supposed to be
    righteous lists with indefinite extent, so RPLAC'ing them ought to be

    However, this was one part of the Common Lisp spec that several early
    implementations deliberately chose to deviate from in the interest of
    greater efficiency.  (Symbolics and TI were able to gain considerable
    efficiency by consing rest args on the stack.)  Both companies had plans
    to fix this eventually, stack-consing only when the compiler could prove
    it was safe to do so, but I don't know if this has finally been
    accomplished and distributed to all users.

I think TI has already fixed it. Symbolics' Cloe also fixes it.
Symbolics Genera plans to fix it at some unspecified future date.

But anyway, the rplaca/rplacd problem is not related to the issue of stack
allocation. It's the following problem, which comes up in conventional
architectures as well:



 (APPLY #'FOO *MY-LIST*) => T ;on Symbolics systems and probably
			      ; many stock hardware implementations

This implies that



 *MY-LIST* => (D B C) ;on Symbolics systems and probably many stock
		      ; hardware implementations