From: Ian Zimmerman <itz@buug.org>
Subject: Re: Structured data in Emacs Lisp
Date: 26 Apr 2005 22:35:54 -0700 [thread overview]
Message-ID: <87k6mo6ath.fsf@buug.org> (raw)
In-Reply-To: <87mzrl4gp7.fsf@lse.ac.uk>
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.
next prev parent reply other threads:[~2005-04-27 5:35 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-04-26 15:20 Structured data in Emacs Lisp PT
2005-04-26 15:28 ` Denis Bueno
[not found] ` <mailman.3069.1114529432.2895.help-gnu-emacs@gnu.org>
2005-04-26 15:57 ` PT
2005-04-26 16:59 ` Jim Ottaway
2005-04-27 5:35 ` Ian Zimmerman [this message]
2005-04-26 16:03 ` Phillip Lord
2005-04-26 17:21 ` PT
2005-04-27 11:13 ` Phillip Lord
2005-04-27 15:27 ` Klaus Berndl
2005-04-27 18:38 ` PT
2005-05-09 21:39 ` Christopher C. Stacy
2005-05-10 10:05 ` Phillip Lord
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=87k6mo6ath.fsf@buug.org \
--to=itz@buug.org \
/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).