In article <············@i2.com> Immanuel Litzroth <·················@i2.com> writes:
> I seem to be unable to find the logic behind
>
> (setq x '(1 2))
> (nconc x '(3 4))
> x evaluates to (1 2 3 4)
>
> BUT
>
> (setq x nil)
> (nconc x '(3 4)) -> evaluates to (3 4)
> x evaluates to nil
>
> I wouldn't mind some enlightenment
Here is a quotation from "Common Lisp. The reference" published by
Franz, Inc.:
"nconc always modifies its arguments (except the last), if
necessary. If the first argument is a variable that evaluates to nil,
the value of the variable will not be changed. Therefore, it is
usually advisable to use setq to change the value oa a variable given
as the first agrument to nconc."
Again, not too much logic. Think of it this way: nconc modifies the CDR
of a cons pair. Since it is not always clear what is the CDR of nil
(and I believe it is implementation-dependent), it is safer to leave
nil as is.
--
Keep talking! /~~~~~~~~~~~~~~~
Dmitry Zinoviev / /~~~~~~~~/
/ `~~~~~~~'
_From the Other Side of the World ____________/ Long Island, NY