[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: copy-sequence no longer copies rings
From: |
David Kastrup |
Subject: |
Re: copy-sequence no longer copies rings |
Date: |
Thu, 25 Oct 2007 23:35:32 +0200 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.1.50 (gnu/linux) |
"Stephen J. Turnbull" <address@hidden> writes:
> David Kastrup writes:
>
> > If `copy-sequence' allows for dotted lists, so should `length'. I am
> > not sure I like the implications since every list implicitly is also a
> > dotted list.
> >
> > To wit:
> > (copy-sequence '(2 3 . (4 5))) creates an element-wise copy of (4 5)
> > while (copy-sequence '(2 3 . [4 5])) would not create an element-wise
> > copy of [4 5].
> >
> > (length '(2 3 . (4 5))) is 4, while (length '(2 3 . [4 5])) should
> > presumably be 3.
>
> I don't see the problem. `(2 3 . (4 5))' is just notation; the
> structure is `(2 . (3 . (4 . (5 . nil))))'.
Yes, that is the point. It's just notation. So what is the principal
difference between a cdr that is a list, and a cdr that is a non-list
cons cell? Or should every cons cell be called a list?
(copy-sequence '(2 . (3 . (4 . (5 . nil))))) copies every dotted pair
recursing on the cdr, to a total of 4 dotted pairs.
So what should (copy-sequence '(2 . (3 . (4 . 5)))) copy? 3 dotted
pairs? Probably. But then it would appear logical if the "length"
were 3, too.
> The two cases above surely have lengths 4 and 3 respectively, while
> the interesting case is `(2 3 4 . 5)' which I suppose should have
> length 4, but I'm not massively invested in it.
That's good since I have convinced myself by now that any such
investment should be lost.
--
David Kastrup, Kriemhildstr. 15, 44793 Bochum
- Re: copy-sequence no longer copies rings, (continued)
- Re: copy-sequence no longer copies rings, Richard Stallman, 2007/10/23
- Re: copy-sequence no longer copies rings, Michael Kifer, 2007/10/23
- Re: copy-sequence no longer copies rings, Richard Stallman, 2007/10/23
- Re: copy-sequence no longer copies rings, Johan Bockgård, 2007/10/24
- Re: copy-sequence no longer copies rings, David Kastrup, 2007/10/24
- Re: copy-sequence no longer copies rings, Stephen J. Turnbull, 2007/10/24
- Re: copy-sequence no longer copies rings,
David Kastrup <=
- Re: copy-sequence no longer copies rings, Stephen J. Turnbull, 2007/10/26
- Re: copy-sequence no longer copies rings, David Kastrup, 2007/10/26