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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Structured data in Emacs Lisp


From: Ian Zimmerman
Subject: Re: Structured data in Emacs Lisp
Date: 26 Apr 2005 22:35:54 -0700
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4

Denis> You could use a plist:
Denis> 
Denis> (:key1 1 :key2 2)
Denis> 
Denis> Then to get a particular value:
Denis> 
Denis> (getf '(:key1 1 :key2 2) :key1) => 1
Denis> 

Jim> Or you could use defstruct [also in 'cl]

I don't know how many different structures you have.  If not too many, I
would just use lists (or even better, vectors) and for each field define
an accessor macro:

(defsubst get-key1 (result) (nth 0 result))

or

(defsubst get-key1 (result) (aref result 0))

-- 
Optimist: We're only two weeks behind schedule.
Pessimist: The schedule is a whole two weeks ahead of us.




reply via email to

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