From: Bruce Krulwich
Subject: Re: Lucid bug in delete-if?
Date: 
Message-ID: <KRULWICH.92Nov16104949@zowie.ils.nwu.edu>
Have any implementations ever tried to handle destructive modification of the
first element of a list by RPLACA'ing the first cons cell to the first element
of the desired list?

(Not that this would completely obviate the need to SETF the result of a
destructive operation, but I was just curious.)

Bruce

 
From: Barry Margolin
Subject: Re: Lucid bug in delete-if?
Date: 
Message-ID: <1ecvprINNe6l@early-bird.think.com>
In article <······················@zowie.ils.nwu.edu> ········@zowie.ils.nwu.edu (Bruce Krulwich) writes:
>Have any implementations ever tried to handle destructive modification of the
>first element of a list by RPLACA'ing the first cons cell to the first element
>of the desired list?

I've never heard of anyone doing it, although it's allowed.

>(Not that this would completely obviate the need to SETF the result of a
>destructive operation, but I was just curious.)

Since it doesn't solve the problem (you still have to do the assignment if
the result of the modification is NIL), there's not much point in doing it
this way.  It's less efficient, because you have to do a RPLACA *and* a
RPLACD whenever the CAR matches; and unless you're extra tricky, you'll
also end up doing an extra CDDR to get the value to RPLACD.  This also
requires the CAR to be handled as a special case, otherwise you'll get this
expense for every matching element.


-- 
Barry Margolin
System Manager, Thinking Machines Corp.

······@think.com          {uunet,harvard}!think!barmar