From: KevinZzz
Subject: a simple question that I can't answer...
Date: 
Message-ID: <1167952128.811245.150870@q40g2000cwq.googlegroups.com>
I'm posting something off my emacs that's from my working on Chapter 12
of Peter Seibel's book...

I can see how adjusting my *l* or *ll* effects a change of *lll*, I
expect that changing *lII* won't effect any changes of *l* (it doesn't)
OR of *ll* (it does)...

Here's the stuff of my emacs:

CL-USER> (defparameter *l* (list 1 2 3))
*L*
CL-USER> (defparameter *ll* (list 4 5 6))
*LL*
CL-USER> (defparameter *lll* (append *l* *ll*))
*LLL*
CL-USER> *l*
(1 2 3)
CL-USER> *ll*
(4 5 6)
CL-USER> *lll*
(1 2 3 4 5 6)
CL-USER> (setf (first *ll*) 0)
0
CL-USER> *ll*
(0 5 6)
CL-USER> *lll*
(1 2 3 0 5 6)
CL-USER> (setf (first *ll*) 4)
4
CL-USER> *lll*
(1 2 3 4 5 6)
CL-USER> (setf (first *lll*) 0)
0
CL-USER> *lll*
(0 2 3 4 5 6)
CL-USER> *l*
(1 2 3)
CL-USER> (setf (second *lll*) 0)
0
CL-USER> *lll*
(0 0 3 4 5 6)
CL-USER> *l*
(1 2 3)
CL-USER> (setf (third *lll*) 0)
0
CL-USER> *lll*
(0 0 0 4 5 6)
CL-USER> *l*
(1 2 3)
CL-USER> (setf (fourth *lll*) 0)
0
CL-USER> *lll*
(0 0 0 0 5 6)
CL-USER> *l*
(1 2 3)
CL-USER> *ll*
(0 5 6)                                 ;;;;;;;;;;;;; what????
CL-USER> (setf (fifth *lll*) 0)
0
CL-USER> *lll*
(0 0 0 0 0 6)
CL-USER> *ll*
(0 0 6)

I'm sure that this is my being stupid.. but what gives?

regards, thanks & a happy new year (belated)

Kevin

From: Bill Atkins
Subject: Re: a simple question that I can't answer...
Date: 
Message-ID: <not-a-real-email-D7D5A0.18231804012007@host86-26-113-128.not-set-yet.ntli.net>
In article <························@q40g2000cwq.googlegroups.com>,
 "KevinZzz" <···············@gmail.com> wrote:

> I'm posting something off my emacs that's from my working on Chapter 12
> of Peter Seibel's book...
> 
> I can see how adjusting my *l* or *ll* effects a change of *lll*, I
> expect that changing *lII* won't effect any changes of *l* (it doesn't)
> OR of *ll* (it does)...
> 
> Here's the stuff of my emacs:
> 
> CL-USER> (defparameter *l* (list 1 2 3))
> *L*
> CL-USER> (defparameter *ll* (list 4 5 6))
> *LL*
> CL-USER> (defparameter *lll* (append *l* *ll*))
> *LLL*
> CL-USER> *l*
> (1 2 3)
> CL-USER> *ll*
> (4 5 6)
> CL-USER> *lll*
> (1 2 3 4 5 6)
> CL-USER> (setf (first *ll*) 0)
> 0
> CL-USER> *ll*
> (0 5 6)
> CL-USER> *lll*
> (1 2 3 0 5 6)
> CL-USER> (setf (first *ll*) 4)
> 4
> CL-USER> *lll*
> (1 2 3 4 5 6)
> CL-USER> (setf (first *lll*) 0)
> 0
> CL-USER> *lll*
> (0 2 3 4 5 6)
> CL-USER> *l*
> (1 2 3)
> CL-USER> (setf (second *lll*) 0)
> 0
> CL-USER> *lll*
> (0 0 3 4 5 6)
> CL-USER> *l*
> (1 2 3)
> CL-USER> (setf (third *lll*) 0)
> 0
> CL-USER> *lll*
> (0 0 0 4 5 6)
> CL-USER> *l*
> (1 2 3)
> CL-USER> (setf (fourth *lll*) 0)
> 0
> CL-USER> *lll*
> (0 0 0 0 5 6)
> CL-USER> *l*
> (1 2 3)
> CL-USER> *ll*
> (0 5 6)                                 ;;;;;;;;;;;;; what????

APPEND doesn't copy its last argument.  The behavior you're asking
about here is exactly the same as what you observed above:

> CL-USER> (setf (first *ll*) 0)
> 0
> CL-USER> *ll*
> (0 5 6)
> CL-USER> *lll*
> (1 2 3 0 5 6)

Because the last three elements of *lll* share structure with 
*ll*, changing either will change the other.
From: KevinZzz
Subject: Re: a simple question that I can't answer...
Date: 
Message-ID: <1167953194.097078.206870@q40g2000cwq.googlegroups.com>
Bill Atkins wrote:
> In article <························@q40g2000cwq.googlegroups.com>,
>  "KevinZzz" <···············@gmail.com> wrote:
>
> > I'm posting something off my emacs that's from my working on Chapter 12
> > of Peter Seibel's book...
> >
> > I can see how adjusting my *l* or *ll* effects a change of *lll*, I
> > expect that changing *lII* won't effect any changes of *l* (it doesn't)
> > OR of *ll* (it does)...
> >
> > Here's the stuff of my emacs:
> >
> > CL-USER> (defparameter *l* (list 1 2 3))
> > *L*
> > CL-USER> (defparameter *ll* (list 4 5 6))
> > *LL*
> > CL-USER> (defparameter *lll* (append *l* *ll*))
> > *LLL*
> > CL-USER> *l*
> > (1 2 3)
> > CL-USER> *ll*
> > (4 5 6)
> > CL-USER> *lll*
> > (1 2 3 4 5 6)
> > CL-USER> (setf (first *ll*) 0)
> > 0
> > CL-USER> *ll*
> > (0 5 6)
> > CL-USER> *lll*
> > (1 2 3 0 5 6)
> > CL-USER> (setf (first *ll*) 4)
> > 4
> > CL-USER> *lll*
> > (1 2 3 4 5 6)
> > CL-USER> (setf (first *lll*) 0)
> > 0
> > CL-USER> *lll*
> > (0 2 3 4 5 6)
> > CL-USER> *l*
> > (1 2 3)
> > CL-USER> (setf (second *lll*) 0)
> > 0
> > CL-USER> *lll*
> > (0 0 3 4 5 6)
> > CL-USER> *l*
> > (1 2 3)
> > CL-USER> (setf (third *lll*) 0)
> > 0
> > CL-USER> *lll*
> > (0 0 0 4 5 6)
> > CL-USER> *l*
> > (1 2 3)
> > CL-USER> (setf (fourth *lll*) 0)
> > 0
> > CL-USER> *lll*
> > (0 0 0 0 5 6)
> > CL-USER> *l*
> > (1 2 3)
> > CL-USER> *ll*
> > (0 5 6)                                 ;;;;;;;;;;;;; what????
>
> APPEND doesn't copy its last argument.  The behavior you're asking
> about here is exactly the same as what you observed above:
>
> > CL-USER> (setf (first *ll*) 0)
> > 0
> > CL-USER> *ll*
> > (0 5 6)
> > CL-USER> *lll*
> > (1 2 3 0 5 6)
>
> Because the last three elements of *lll* share structure with
> *ll*, changing either will change the other.

Thanks, as soon as you wrote it; I saw how stupid I'd been...

Too much Cocaine Brownies over the holidays

K