Subject: Re: delete?
From: Erik Naggum <>
Date: 1998/01/24
Newsgroups: comp.lang.lisp
Message-ID: <>

* Greg Schohn
| could anybody explain to me why this code has problems deleting the first
| element of a list when it is selected ...

  DELETE is like NREVERSE or SORT in that they all work through destructive
  operations on (parts of) the argument value, but it is the value returned
  from the function that has all the properties of the performed operation.
  any prior access paths to the argument value will now hold a value that
  is not useful unless you know _exactly_ what the function did.  it's safe
  to assume that you don't, since you had to ask.  in many cases, it is not
  even possible to know exactly what a function did since an implementation
  is free to perform the function in any way that maintains the specified
  invariants and results.  e.g., DELETE on a list is likely to return the
  first cons cell whose car is _not_ the item you want deleted.  if you
  think about it, you realize that it couldn't do anything else, because it
  would have needed access to whatever contained the list as its value to
  do that and only the caller has access to that since Lisp calls functions
  with the computed _values_ of all arguments.  you will therefore have to
  assign the returned value back to the variable to get the desired effect
  of deleting the first element.  (isn't this in some FAQ already?)

The year "98" was new 1900 years ago.  |  Help fight MULE in GNU Emacs 20!
Be year 2000 compliant, write "1998"!  |