emacs-devel
[Top][All Lists]
Advanced

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

Re: Is this a bug of Emacs-Lisp?


From: Sascha Wilde
Subject: Re: Is this a bug of Emacs-Lisp?
Date: Fri, 17 Feb 2006 23:34:32 +0100
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

Zhang Wei <address@hidden> wrote:

> (defun dummy () '(1 . 2))
>
> (dummy)
>  => (1 . 2)
>
> (setcdr (dummy) 3)
>
> (dummy)
>  => (1 . 3)
>
> Modify the return value of dummy changed it's defination.

No.  The function dummy returns a cons cell -- all ways the _same_
cons cell, so if you change it, well it ends up changed.  :-)

What you might want is:

(defun dummy () (cons 1 2))

cheers
sascha
-- 
Sascha Wilde

Lisp is the red pill.
  -- John Fraser, comp.lang.lisp




reply via email to

[Prev in Thread] Current Thread [Next in Thread]