Re: Having trouble deleting first item in list



"jonathon" <j_mckitrick@xxxxxxxxxxx> writes:

>This version of the function works as expected. But when I uncomment
>the one line and comment out the setf line, it will never delete the
>first (zeroth) entry. Why is this?

Because it cannot destructively remove the first element of a list.
You'd have to adjust the references in all variables pointing to that
list instead to do so.
If you visualize it on paper with the list in box-notation, you'll see
why this is so.

mkb.
.



Relevant Pages

  • Re: using setf with assoc
    ... > I noticed that (setf (assoc key alist) newvalue) fails, ... (setf (cdr (assoc key alist)) ... Prev by Date: ...
    (comp.lang.lisp)
  • Re: Mac OS X Server Root User
    ... > uncomment the line: ... > Run "sudo newaliases" when yer done. ... Prev by Date: ...
    (comp.sys.mac.system)
  • Re: (setf (if c x y) val)
    ... > I've read on some site that the code (setf (if c x y) val) is wrong. ... because ANSI CL does not require IF to be a SETF place. ... this is a CLISP extension. ... Prev by Date: ...
    (comp.lang.lisp)
  • Wierd issue with File::Find and directory
    ... use strict; ... ### UNCOMMENT AND COMMENT OUT THE LINES TO SEE THE ISSUE ... print Dumper $dir_tree; ... Prev by Date: ...
    (comp.lang.perl.misc)
  • problem with babel and xy
    ... I write the next file with the xy example of the xyguide: ... The document works fine if I don't uncomment the second line, ... else the box is not drawing and its code is printed. ... Prev by Date: ...
    (comp.text.tex)