From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: tomas@tuxteam.de Newsgroups: gmane.emacs.help Subject: Re: until-found Date: Thu, 10 Dec 2009 14:58:03 +0100 Message-ID: <20091210135803.GA8534@tomas> References: <4B20EE79.607@online.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; x-action=pgp-signed Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1260453856 30076 80.91.229.12 (10 Dec 2009 14:04:16 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 10 Dec 2009 14:04:16 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Andreas Roehler Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Dec 10 15:04:06 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 1NIjcj-0004nz-QY for geh-help-gnu-emacs@m.gmane.org; Thu, 10 Dec 2009 15:04:06 +0100 Original-Received: from localhost ([127.0.0.1]:41060 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NIjch-0005OZ-1l for geh-help-gnu-emacs@m.gmane.org; Thu, 10 Dec 2009 09:04:03 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NIjcE-0005MS-QV for help-gnu-emacs@gnu.org; Thu, 10 Dec 2009 09:03:34 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NIjcA-0005Em-JM for help-gnu-emacs@gnu.org; Thu, 10 Dec 2009 09:03:34 -0500 Original-Received: from [199.232.76.173] (port=59142 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NIjcA-0005EQ-CH for help-gnu-emacs@gnu.org; Thu, 10 Dec 2009 09:03:30 -0500 Original-Received: from alextrapp1.equinoxe.de ([217.22.192.104]:47241 helo=www.elogos.de) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NIjc9-00060h-VQ for help-gnu-emacs@gnu.org; Thu, 10 Dec 2009 09:03:30 -0500 Original-Received: by www.elogos.de (Postfix, from userid 1000) id 927D390049; Thu, 10 Dec 2009 14:58:03 +0100 (CET) Content-Disposition: inline In-Reply-To: <4B20EE79.607@online.de> User-Agent: Mutt/1.5.15+20070412 (2007-04-11) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) 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:70554 Archived-At: -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Thu, Dec 10, 2009 at 01:50:01PM +0100, Andreas Roehler wrote: >=20 > Hi, >=20 > given a list or a list of lists: > list shall be returned, if it contains a certain member. >=20 > I'm pretty sure a general form exists, but ignore it. [...] > (defun until-found (search-string liste) > (let ((liste liste) element) > (while liste > (if (member search-string (car liste)) > (setq element (car liste) liste nil)) > (setq liste (cdr liste))) > element)) >=20 Have a look at assoc -- it might be what you are looking for. If you need more flexibility, cl's assoc* (where you can specify, among other things, the comparison function) might fit your bill. Regards - -- tom=C3=A1s -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQFLIP5rBcgs9XrR2kYRAjsjAJwNovO3/6lB59xeqk6ueXZ+JfA4zQCfX0Xm 4UhpD99BTnp9HIZcVqDb97s=3D =3D+rTv -----END PGP SIGNATURE-----