[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to populate a property list?
From: |
Hattuari |
Subject: |
Re: How to populate a property list? |
Date: |
Sat, 30 Oct 2004 13:54:56 -0400 |
User-agent: |
KNode/0.8.1 |
Thien-Thi Nguyen wrote:
> Hattuari <susudata@setidava.kushan.aa> writes:
>
>> a plist has unique keys
>
> only if constructed that way.
>
> consider this *scratch* buffer snapshot:
>
> (setq x '(:k1 1 :k2 2 :k1 42))
>
> (plist-get x :k1)
> 1
>
> (plist-get (cddr x) :k1)
> 42
>
> here, `(cddr x)' has unique keys, but `x' does not. both have the plist
> form (i.e., are amenable to passing to `plist-get' or being hung off a
> symbol). if you use `x' w/ assumption of unique keys, certain usage
> patterns will end up hiding the second :k1 from you but not actually
> recycling it. result: unsightly (literally!) bloat. e.g., continuing
> from above:
>
> (setplist 'x x)
> (:k1 1 :k2 2 :k1 42)
>
> (get 'x :k1)
> 1
>
> (put 'x :k1 "one")
> "one"
>
> (get 'x :k1)
> "one"
>
> all's cool from `put' and `get' pov, right? but the truth is deeper;
> ignorance of it does not make it go away:
>
> x
> (:k1 "one" :k2 2 :k1 42)
>
> thi
I don't know what to make of this then:
edition 2.9 of the GNU Emacs Lisp Reference Manual, corresponding to GNU
Emacs version 21.3, ยง8.4.1 Property Lists and Association Lists
------------------------------------------
"Association lists (*note Association Lists::) are very similar to
property lists. In contrast to association lists, the order of the
pairs in the property list is not significant since the property names
must be distinct."
--
p->m == (*p).m == p[0].m
- How to populate a property list?, Hattuari, 2004/10/26
- Re: How to populate a property list?, Thien-Thi Nguyen, 2004/10/26
- Re: How to populate a property list?, Kevin Rodgers, 2004/10/26
- Re: How to populate a property list?, Hattuari, 2004/10/30
- Re: How to populate a property list?, Thien-Thi Nguyen, 2004/10/30
- Re: How to populate a property list?,
Hattuari <=
- Re: How to populate a property list?, Thien-Thi Nguyen, 2004/10/30
- Re: How to populate a property list?, Hattuari, 2004/10/31
- Re: How to populate a property list?, Thien-Thi Nguyen, 2004/10/31
- Re: How to populate a property list?, Hattuari, 2004/10/31
Re: How to populate a property list?, Kai Grossjohann, 2004/10/31