[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: what gives with del!?
> (lset show '(a a a b a c a d))
(A A A B A C A D)
> (del! eq? 'a show)
(B C D)
(A A A B C D)
... why doesn't it work on the prelist?
DEL! removes elements from a list and will possibly modify the
list. DEL! has no way to change the value of the variable to
which the argument to DEL! was bound. If you want the value of the
variable changed, you have to do that yourself. So, you should have
(set show (del! eq? 'a show))
If this is still seems strange, write out a diagram of the
list as cons cells, with the variable SHOW pointing to the
first. Then think of what the DEL! procedure does to the list,
and what it would have to do to yield the result you expected.