[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Structured data in Emacs Lisp
From: |
Phillip Lord |
Subject: |
Re: Structured data in Emacs Lisp |
Date: |
10 May 2005 11:05:00 +0100 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.4 |
>>>>> "Christopher" == Christopher C Stacy <cstacy@news.dtpq.com> writes:
Christopher> PT <mailshield.gg@mailnull.com> writes:
>> For example, from a function I want to return three values. How
>> should I do this?
>> Using a list? (Value1 Value2 Value3)?
>> Or maybe an association list? '((value1 . 3) (value2 . 4) (value3
>> . 5))
>> Or is there an other Lispish way to handle structured data I
>> don't know about?
Christopher> This isn't going to help with your Emacs problem, but
Christopher> just so you know: Emacs Lisp is a very simple kind of
Christopher> Lisp, lacking many features present in most modern
Christopher> (post-1979) dialects of Lisp. For example, in ANSI
Christopher> Common Lisp, you can directly pass mutiple values
Christopher> around without packing them into some kind of
Christopher> container. And for representing structured data, you
Christopher> can use either structs or object-oriented
Christopher> programming. There are of course many other data types
Christopher> and a zillion other important features in "real" Lisp
Christopher> that Emacs Lisp doesn't have. I'm telling you this
Christopher> because you asked for a "Lispy" way to do things.
Christopher> I think the "CL" library in Emacs Lisp might give you
Christopher> some version of DEFSTRUCT, which is something like the
Christopher> one in Common Lisp.
Much of what you say about emacs lisp is true. But it is worth
mentioning that you can do all three of the things you mention
here. Multiple values you can pass around with the :construct, structs
with CL and classes with eieio (which is not a standard part of
emacs).
Phil