From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Decebal Newsgroups: gmane.emacs.help Subject: Re: Something like an array (list) of a class Date: Sun, 12 Apr 2009 00:25:17 -0700 (PDT) Organization: http://groups.google.com Message-ID: <9fe617de-13d8-4dbc-82f8-3cc575008e48@o18g2000vbi.googlegroups.com> References: <665d0b7a-3230-4123-b9f4-2a645f44dd1c@a7g2000yqk.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1239522050 12025 80.91.229.12 (12 Apr 2009 07:40:50 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 12 Apr 2009 07:40:50 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Apr 12 09:42:09 2009 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1LsuKM-0003TO-Es for geh-help-gnu-emacs@m.gmane.org; Sun, 12 Apr 2009 09:42:06 +0200 Original-Received: from localhost ([127.0.0.1]:49832 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LsuIx-00014u-OD for geh-help-gnu-emacs@m.gmane.org; Sun, 12 Apr 2009 03:40:39 -0400 Original-Path: news.stanford.edu!newsfeed.stanford.edu!postnews.google.com!o18g2000vbi.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 36 Original-NNTP-Posting-Host: 84.53.123.169 Original-X-Trace: posting.google.com 1239521117 28326 127.0.0.1 (12 Apr 2009 07:25:17 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Sun, 12 Apr 2009 07:25:17 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: o18g2000vbi.googlegroups.com; posting-host=84.53.123.169; posting-account=K-cdeAoAAAD_0d505kUtHXJaT5LFIu-3 User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux i686; nl; rv:1.9.0.8) Gecko/2009032608 Firefox/3.0.8,gzip(gfe),gzip(gfe) Original-Xref: news.stanford.edu gnu.emacs.help:168405 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:63684 Archived-At: On Apr 11, 10:08=A0am, thierry.volpia...@gmail.com wrote: > > 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) > | =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (find-if 'stringp B) > | =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (find-if 'functionp B) > | =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (null (car (last B)))) > | =A0 =A0 =A0 =A0 =A0 =A0t > | =A0 =A0 =A0 =A0 =A0 =A0nil) > | t > `---- Partly. This is an 'object' and not a list of objects. But I understand correctly that it is not possible to define real objects? What I would like is something like (C++ code): class Object { String type; String description; String functionname; String displayString; } std::vector objectVector; When given a certain type I then need to retreive the 'object' from the list to use.