[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Deleteing from a list

David Arnold <daa93@aber.ac.uk> writes about the DELETE function:

> It seems that
> you cannot delete the first item in a list. The value returned is
> correct but the list itself is not altered

You mean that you have stored the list in a variable and would like the
variable to be automatically updated when you call DELETE. This is not
possible because the DELETE function does not know in which variables
the list has been stored. (Just altering the list structure wouldn't help
in the case when you are deleting the first item of a list of length 1.)

Stop thinking in terms of side-effects, and think of DELETE as a _function_
which _returns_ a list with some elements missing, just like REMOVE, the
only difference between DELETE and REMOVE being that DELETE _may_ reuse
the storage occupied by the argument.

                    Bruno Haible