help-gnu-emacs
[Top][All Lists]
Advanced

[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 08:05:58 -0400
User-agent: KNode/0.8.1

Kevin Rodgers wrote:

> Hattuari wrote:
>  > Suppose I have a collection of key values pairs as follows:
>  >
>  > char  c
>  > short s
>  > int   i
>  > long  l
>  >
>  > I want to put them in a property list.  I can do this:
> 
> Why a property list instead of an association list?
> 
> (setq type-map
>        '((char . c)
>          (short . s)
>          (int . i)
>          (long . l)))
> 

I didn't notice this message until just now.  It must have taken the long
way around to the server I read from.  The aspect of a plist which fits my
situation better is that a plist has unique keys.  An alist can have
multiple instances of the same key.  Thus a plist maps more accurately to
the logical structure of my data.  I have to confess, I'm finding both
alist and plist a bit awkward to work with.  The alist isn't necessarily a
Lisp list, and the plist isn't doesn't have some of the facilities I would
like for accessing and manipulating the data.

I suspect with time I will find reasonably concise means of expressing these
operations.  Lisp requires a different kind of thinking than other
languages I've worked with.  The closest language to Lisp that I have any
significant experience with is Mathematica.
-- 
p->m == (*p).m == p[0].m


reply via email to

[Prev in Thread] Current Thread [Next in Thread]