Subject: Re: problem with delete From: Erik Naggum <email@example.com> Date: 2000/10/02 Newsgroups: comp.lang.lisp Message-ID: <firstname.lastname@example.org> * Frode Vatvedt Fjeld <email@example.com> | You are _supposed_ to do (setf foo (delete 1 foo)). Simply doing | (delete 1 foo) has an undefined result. No, it is very well defined. It just isn't what some people expect. | To understand this, note that DELETE is a function, and so takes | arguments by value. There is nothing wrong with a delete function that modifies the list such that the variables keeps pointing to a list sans the first element. (delete 1 (vector 1 2 3 4 5)) manages this, remember? | This is a general rule that applies to most (or all?) destructive | functions: They should be called exactly the same way you would call | their non-destructive counterparts. Good point. However, recall that they are allowed to nuke their arguments, so if you got any of those (susceptible) arguments from someone else and you haven't agreed on an object ownership protocol, you'd better be careful not to alter somebody else's objects. #:Erik -- If this is not what you expected, please alter your expectations.