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: Denis Bueno
Subject: Re: Structured data in Emacs Lisp
Date: Tue, 26 Apr 2005 11:28:48 -0400

On 4/26/05, PT <mailshield.gg@mailnull.com> wrote:
<snip explanation>

> Or maybe an association list? '((value1 . 3) (value2 . 4) (value3 . 5))
> It's certainly more resistant to code changes, but feels a bit
> heavyweight. (Maybe its just me.)

You could use a plist:

  (:key1 1 :key2 2)

Then to get a particular value:

(getf '(:key1 1 :key2 2) :key1)
=> 1

According to C-h f getf RET:

  getf is a compiled Lisp function in `cl-extra'.
  (getf plist tag &optional def)

So you might need to do (require 'cl) before using it....

-Denis
PGP: http://pgp.mit.edu:11371/pks/lookup?search=0xA1B51B4B&op=index




reply via email to

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