[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug, bug, whos's got the bug
Date: Fri, 11 Sep 1992 16:53 EDT
From: Robin Kladke 977-9760 <robin@orion.den.mmc.com> (303)
The correct behavior for the following scenario does not seem to be
documented. As a result, the Symbolics (Genera 8.1.1) and Allegro
(whatever newest is) handling differs. Could someone tell me what
the correct behavior should be for reverse and nreverse?
(setq x (cons 'a (cons 'b 'c)))
[Both]--> (A B . C)
(reverse x)
[Symbolics]--> Trap: The first argument to the ENDP instruction, C, was not a list.
[Allegro]--> (B A)
(setq z (nreverse x))
[Both]--> (B A)
x
[Both]--> (A)
--Robin Kladke
robin@jarrett.den.mmc.com
Martin Marietta, Denver, CO
REVERSE and NREVERSE are only defined to work on sequences, which can be
either vectors or proper lists. Their behavior on dotted lists is not
specified by CLtL, so any behavior is permitted.
dpANS Common Lisp is a little more specific. It says that they "should
be prepared to signal an error of type TYPE-ERROR if <sequence> is not a
proper sequence." This means that when the SAFETY optimization setting
is 3, they should detect and report the error (in the case of these two
functions, I'm not sure there's a real difference between "should
signal" and "should be prepared to signal", since they have to touch all
the cons cells in the original list).
barmar