[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: One more question about elisp

From: Xah Lee
Subject: Re: One more question about elisp
Date: Fri, 6 Nov 2009 12:02:23 -0800 (PST)
User-agent: G2/1.0

On Nov 6, 8:46 am, Francis Moreau <address@hidden> wrote:
> Hello,
> I'm now wondering what is the elisp way to create structured objects
> and how to access them later.
> For example I want to create a structure/object which store
> information about a person.
> In C language, I would do something like this:
> structure person {
>     int age;
>     char *name;
> };
> For an object oriented language, Python for example, I would do:
> class Person(object):
>     def __init__(self, age, name):
>         self.age = age
> = name
> but how I do that in elisp ?
> Should I use a list ? That wouldn't be convenient for accessing the
> 'fields' of the object later since I need to use an index rather than
> a name field.
> Could anybody provide a pointer or any hints ?

you can use  Association Lists or hash table. For a short tutorial,

• Elisp Lesson: Hash Table


reply via email to

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