unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Structured data in Emacs Lisp
@ 2005-04-26 15:20 PT
  2005-04-26 15:28 ` Denis Bueno
                   ` (4 more replies)
  0 siblings, 5 replies; 12+ messages in thread
From: PT @ 2005-04-26 15:20 UTC (permalink / raw)


I'm writing a moderately complex Emacs package and not being a Lisp guru I  
wonder what is the best way to handle data structures in Elisp. The  
emphasis is not on efficiency, rather on readability.

For example, from a function I want to return three values. How should I  
do this?

Using a list? (Value1 Value2 Value3)?

This has the disadvantage of storing specific values on specific  
positions, so the caller must now the first element of the list is Value1,  
etc. And what if the return value is changed later and Value2 is not  
returned anymore? Then I have to fix every invocation of the function.

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.)

Or is there an other Lispish way to handle structured data I don't know  
about?

-- 
Using Opera's revolutionary e-mail client: http://www.opera.com/m2/

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2005-05-10 10:05 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

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).