From: Hattuari <susudata@setidava.kushan.aa>
Subject: Re: How to populate a property list?
Date: Sat, 30 Oct 2004 13:54:56 -0400 [thread overview]
Message-ID: <1tCdneLTFrxuSB7cRVn-pA@speakeasy.net> (raw)
In-Reply-To: 7ezn243zah.fsf@ada2.unipv.it
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
next prev parent reply other threads:[~2004-10-30 17:54 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-10-26 10:09 How to populate a property list? Hattuari
2004-10-26 12:28 ` Thien-Thi Nguyen
2004-10-27 20:38 ` Hattuari
2004-10-31 14:39 ` Kai Grossjohann
2004-10-26 15:24 ` Kevin Rodgers
2004-10-30 12:05 ` Hattuari
2004-10-30 17:12 ` Thien-Thi Nguyen
2004-10-30 17:54 ` Hattuari [this message]
2004-10-30 20:17 ` Thien-Thi Nguyen
2004-10-31 8:32 ` Hattuari
2004-10-31 8:57 ` Thien-Thi Nguyen
2004-10-31 15:23 ` Hattuari
2004-11-01 16:44 ` Kevin Rodgers
2004-10-31 14:36 ` Kai Grossjohann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1tCdneLTFrxuSB7cRVn-pA@speakeasy.net \
--to=susudata@setidava.kushan.aa \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).