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

Re: remove



In article <1992Nov23.161022.20210@mail.cornell.edu> tsl1@cornell.edu (Tim Larkin) writes:
>In article <HALTRAET.92Nov20091121@monsun.si.no> Hallvard Tr{tteberg,
>haltraet@monsun.si.no writes:
>>It shouldn't be difficult to write one that kept the biggest unchanged
>>tail of the original list, returning the whole unmodified list if it
>>didn't contain the first argument.
>
>On the other hand, Common Lisp, the Manual, states that "the result [of 
>remove] is a copy of the input sequence." If you return part of the 
>original list, then you change the contract of the function.

Well, ... no.

Common Lisp, The Language, says what you quote above but then
goes on to say "The result of REMOVE may share with the argument
sequence; ...".  See page 400 of CLtL II.

>Sometimes one uses remove and requires a totally new list.

You can lose if you rely on REMOVE returning a new list.

-- jd