[Top][All Lists]

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

Re: Something like an array (list) of a class

From: thierry . volpiatto
Subject: Re: Something like an array (list) of a class
Date: Sat, 11 Apr 2009 10:08:28 +0200
User-agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.0.92 (gnu/linux)

Hi Decebal,
Decebal <address@hidden> writes:

> I would like to make some datadriven functionality. Is there a way to
> make sure a list is filled with a certain type of data. I would like
> to make sure that every element of my list contains: a type, a
> description, a functionname and room to store a string. Is this
> possible?

Maybe that help?
| ELISP> (setq B '(2 "some text" message nil))
| (2 "some text" message nil)
| ELISP> (if (and (find-if 'numberp B)
|                 (find-if 'stringp B)
|                 (find-if 'functionp B)
|                 (null (car (last B))))
|            t
|            nil)
| t

> Also what is the best way to fetch the element of the list that is of
> a specific type (first field of the object)?

The same with `find-if'

A + Thierry Volpiatto
Location: Saint-Cyr-Sur-Mer - France

reply via email to

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