From: Ron Garret on
In article <rNOSPAMon-D75788.21183404012010(a)news.albasani.net>,
Ron Garret <rNOSPAMon(a)flownet.com> wrote:

> In article
> <d50e5346-8eef-457c-929e-4cce045a4e17(a)j5g2000yqm.googlegroups.com>,
> mdj <mdj.mdj(a)gmail.com> wrote:
>
> > On Jan 5, 12:14 pm, Kenneth Tilton <kentil...(a)gmail.com> wrote:
> >
> > > Where has anybody timed a plist? I see no timings of the plist
> > > implementation. Does everyone know what is a plist? Am I the only one
> > > that understands that PB quickly abandoned "plists are just as fast" as
> > > soon as he realized his gaffe and pretended the issue was defstructs of
> > > type list?
> >
> > I just assume list based structs are plists and not alists
>
> Why do you think they have to be one or the other?

BTW, here's a clue:

? (defstruct foo a b)
FOO
? (setf foo1 (make-foo :a 'a :b 'b))
#S(FOO :A A :B B)
? (defstruct foo b a)
FOO
? foo1
#S(FOO :B A :A B)


rg
From: Madhu on
* Ron Garret <rNOSPAMon-A6D739.21222604012010(a)news.albasani.net> :
Wrote on Mon, 04 Jan 2010 21:22:26 -0800:
|> In article
|> <d50e5346-8eef-457c-929e-4cce045a4e17(a)j5g2000yqm.googlegroups.com>,
|> mdj <mdj.mdj(a)gmail.com> wrote:
|
|> > I just assume list based structs are plists and not alists
|>
|> Why do you think they have to be one or the other?
|
| BTW, here's a clue:
|
| ? (defstruct foo a b)
| FOO
| ? (setf foo1 (make-foo :a 'a :b 'b))
| #S(FOO :A A :B B)
| ? (defstruct foo b a)
| FOO
| ? foo1
| #S(FOO :B A :A B)

First This is not conformant code. The standard clearly states:
`The consequences of redefining a defstruct structure are undefined.'
<http://www.lispworks.com/documentation/HyperSpec/Body/m_defstr.htm>

What you are actually illustrating is how your particular lisp
implementation changes the layout of existing instances after a
structure definition has changed. Other implementation choices could
choose to keep the old instances in their old layouts.

In any case this has no relevance to using either alists or plists or
simple position based lists (accessed by NTH) and is bound to be
misleading.

--
Madhu
From: Ron Garret on
In article <m3my0tf3if.fsf(a)moon.robolove.meer.net>,
Madhu <enometh(a)meer.net> wrote:

> * Ron Garret <rNOSPAMon-A6D739.21222604012010(a)news.albasani.net> :
> Wrote on Mon, 04 Jan 2010 21:22:26 -0800:
> |> In article
> |> <d50e5346-8eef-457c-929e-4cce045a4e17(a)j5g2000yqm.googlegroups.com>,
> |> mdj <mdj.mdj(a)gmail.com> wrote:
> |
> |> > I just assume list based structs are plists and not alists
> |>
> |> Why do you think they have to be one or the other?
> |
> | BTW, here's a clue:
> |
> | ? (defstruct foo a b)
> | FOO
> | ? (setf foo1 (make-foo :a 'a :b 'b))
> | #S(FOO :A A :B B)
> | ? (defstruct foo b a)
> | FOO
> | ? foo1
> | #S(FOO :B A :A B)
>
> First This is not conformant code.

I didn't say it was.

> In any case this has no relevance to using either alists or plists or
> simple position based lists (accessed by NTH) and is bound to be
> misleading.

That's true, but that's not the topic I was addressing. The topic I was
addressing was whether the assumption that "list based structs are
plists and not alists" is reasonable.

rg
From: Madhu on

* Ron Garret <rNOSPAMon-79BB44.23220404012010(a)news.albasani.net> :
Wrote on Mon, 04 Jan 2010 23:22:04 -0800:

|>
|> First This is not conformant code.
|
| I didn't say it was.
|
|> In any case this has no relevance to using either alists or plists or
|> simple position based lists (accessed by NTH) and is bound to be
|> misleading.
|
| That's true, but that's not the topic I was addressing. The topic I
| was addressing was whether the assumption that "list based structs are
| plists and not alists" is reasonable.

Right, My point was that not only was the code you posted
non-conformant, but it is also not relevant to addressing the assumption
you wish to address. To repeat what I said, the code you posted
illustrates what one your particular lisp implementation changes the
layout of existing instances after a structure definition has
changed. There are other alternatives in other implementations.

Besides What you shewed was the printed representation of the structure
which has no direct relevance to how it is implemented --- in whatsoever
way --- be it ANY type of lists or arrays. One could layout a defstruct
instance using a persistent database backend, and it would still print
as #S(:A 10 :B 20).

--
Madhu
From: mdj on
On Jan 5, 5:22 pm, Ron Garret <rNOSPA...(a)flownet.com> wrote:
> In article <m3my0tf3if....(a)moon.robolove.meer.net>,
>
>
>
>  Madhu <enom...(a)meer.net> wrote:
> > * Ron Garret <rNOSPAMon-A6D739.21222604012...(a)news.albasani.net> :
> > Wrote on Mon, 04 Jan 2010 21:22:26 -0800:
> > |> In article
> > |> <d50e5346-8eef-457c-929e-4cce045a4...(a)j5g2000yqm.googlegroups.com>,
> > |>  mdj <mdj....(a)gmail.com> wrote:
> > |
> > |> > I just assume list based structs are plists and not alists
> > |>
> > |> Why do you think they have to be one or the other?
> > |
> > | BTW, here's a clue:
> > |
> > | ? (defstruct foo a b)
> > | FOO
> > | ? (setf foo1 (make-foo :a 'a :b 'b))
> > | #S(FOO :A A :B B)
> > | ? (defstruct foo b a)
> > | FOO
> > | ? foo1
> > | #S(FOO :B A :A B)
>
> > First This is not conformant code.
>
> I didn't say it was.
>
> > In any case this has no relevance to using either alists or plists or
> > simple position based lists (accessed by NTH) and is bound to be
> > misleading.
>
> That's true, but that's not the topic I was addressing.  The topic I was
> addressing was whether the assumption that "list based structs are
> plists and not alists" is reasonable.

It's not. My bad. List structures are required by the standard to be
position based, and the car will be the structure name if it's :name'd
in the defstruct. Accessors (at least in SBCL) use ELT to access the
element, since you're free to specify vector as the type instead of
list.

In any case, the example you gave was of an untyped defstruct, which
will be a class, not a list, and the implementation is free to
implement slots on classes however it sees fit.

Matt