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):
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):
"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