[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
- To: Fahlman@C.CS.CMU.EDU
- Subject: &REST lists
- From: Kent M Pitman <KMP@STONY-BROOK.SCRC.Symbolics.COM>
- Date: Mon, 4 Jan 88 21:31 EST
- Cc: CL-Cleanup@SAIL.STANFORD.EDU
- In-reply-to: <FAHLMAN.12364037774.BABYL@C.CS.CMU.EDU>
[Common-Lisp removed; I can't bear to be heard by such multitudes.
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:
(DEFVAR *MY-LIST* '(A B C))
(DEFUN FOO (&REST X) (EQ X *MY-LIST*))
(APPLY #'FOO *MY-LIST*) => T ;on Symbolics systems and probably
; many stock hardware implementations
This implies that
(DEFUN BAR (&REST X) (RPLACA X 'D))
(APPLY #'BAR *MY-LIST*)
*MY-LIST* => (D B C) ;on Symbolics systems and probably many stock
; hardware implementations
- &REST lists
- From: Eric Benson <email@example.com>