all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: PT <mailshield.gg@mailnull.com>
Subject: Structured data in Emacs Lisp
Date: Tue, 26 Apr 2005 17:20:42 +0200	[thread overview]
Message-ID: <op.spuh8su4p52o26@home-ca12fabbc0> (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/

             reply	other threads:[~2005-04-26 15:20 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-04-26 15:20 PT [this message]
2005-04-26 15:28 ` Structured data in Emacs Lisp 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

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=op.spuh8su4p52o26@home-ca12fabbc0 \
    --to=mailshield.gg@mailnull.com \
    /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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.