home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!think.com!barmar
- From: barmar@think.com (Barry Margolin)
- Newsgroups: comp.lang.lisp
- Subject: Re: Lucid bug in delete-if?
- Date: 18 Nov 1992 08:44:43 GMT
- Organization: Thinking Machines Corporation, Cambridge MA, USA
- Lines: 24
- Message-ID: <1ecvprINNe6l@early-bird.think.com>
- References: <1992Nov14.180229.7728@cs.cornell.edu> <1992Nov14.205620.11328@news2.cis.umn.edu> <KRULWICH.92Nov16104949@zowie.ils.nwu.edu>
- NNTP-Posting-Host: gandalf.think.com
-
- In article <KRULWICH.92Nov16104949@zowie.ils.nwu.edu> krulwich@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.
-
- barmar@think.com {uunet,harvard}!think!barmar
-