Author: Pascal J. BourguignonPascal J. Bourguignon Date: Sep 13, 2008 02:38
sunway gmail.com> writes:
> (add-to-list 'll "a")
> (delete-dups ll)
>
> The variable "ll" needs be quoted in add-to-list, while not quoted in
> delete-dups, why? any special reasons?
Lisp passes its arguments by-value.
Therefore a function cannot modify the variables from which the values
it gets come.
It still can modify the value, when it is mutable, but not the variable.
Usually, when we want to have a variable (or in general, a place)
modified, we have to use a macro, or a special operator.
(setq ll (list 1 2 3)) ; setq is a special operator.
(require 'cl)
(push 0 ll) ; push is a macro
Otherwise, you must take care to get the result and store it back into
the variable:
|