From: basman
Subject: let with a literal list bug?
Date: 
Message-ID: <1170366039.987817.67240@h3g2000cwc.googlegroups.com>
Here's something I typed into Allegro Lisp 7.0 just now.  Is this what
should be happening?
- Bhaskara

(defun foo ()
		(let ((x '(a . 0)))
		  (incf (cdr x))
		  x))
FOO
CL-USER(2): (foo)
(A . 1)
CL-USER(3): (foo)
(A . 2)
CL-USER(4):

From: basman
Subject: Re: let with a literal list bug?
Date: 
Message-ID: <1170366330.512619.254730@a34g2000cwb.googlegroups.com>
Never mind.  Upon some searching through the archives, I discovered
that this is the infamous "mutable constant" mistake.
- Bhaskara

On Feb 1, 4:40 pm, "basman" <········@gmail.com> wrote:
> Here's something I typed into Allegro Lisp 7.0 just now.  Is this what
> should be happening?
> - Bhaskara
>
> (defun foo ()
>                 (let ((x '(a . 0)))
>                   (incf (cdr x))
>                   x))
> FOO
> CL-USER(2): (foo)
> (A . 1)
> CL-USER(3): (foo)
> (A . 2)
> CL-USER(4):
From: Thomas A. Russ
Subject: Re: let with a literal list bug?
Date: 
Message-ID: <ymiabzsay50.fsf@sevak.isi.edu>
"basman" <········@gmail.com> writes:

> Never mind.  Upon some searching through the archives, I discovered
> that this is the infamous "mutable constant" mistake.
> - Bhaskara

Great!

You are to be commended on being able to find the solution on your own.
Many new posters here are not quite so skillful.  Welcome to Lisp!


-- 
Thomas A. Russ,  USC/Information Sciences Institute