From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?UTF-8?B?QW5kcmVhcyBSw7ZobGVy?= Newsgroups: gmane.emacs.help Subject: Re: until-found Date: Fri, 11 Dec 2009 11:33:42 +0100 Message-ID: <4B222006.10305@easy-emacs.de> References: <4B20EE79.607@online.de> <20091210135803.GA8534@tomas> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1260527833 22350 80.91.229.12 (11 Dec 2009 10:37:13 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 11 Dec 2009 10:37:13 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: tomas@tuxteam.de Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Dec 11 11:37:05 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 1NJ2rw-00018p-Sl for geh-help-gnu-emacs@m.gmane.org; Fri, 11 Dec 2009 11:37:05 +0100 Original-Received: from localhost ([127.0.0.1]:47681 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NJ2rw-00034G-Nu for geh-help-gnu-emacs@m.gmane.org; Fri, 11 Dec 2009 05:37:04 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NJ2os-0001jf-Te for help-gnu-emacs@gnu.org; Fri, 11 Dec 2009 05:33:54 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NJ2on-0001hY-V5 for help-gnu-emacs@gnu.org; Fri, 11 Dec 2009 05:33:54 -0500 Original-Received: from [199.232.76.173] (port=58810 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NJ2on-0001hT-IQ for help-gnu-emacs@gnu.org; Fri, 11 Dec 2009 05:33:49 -0500 Original-Received: from moutng.kundenserver.de ([212.227.126.187]:60818) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NJ2on-0007LW-Bw for help-gnu-emacs@gnu.org; Fri, 11 Dec 2009 05:33:49 -0500 Original-Received: from [192.168.178.27] (p54BE8ED8.dip0.t-ipconnect.de [84.190.142.216]) by mrelayeu.kundenserver.de (node=mreu0) with ESMTP (Nemesis) id 0LgtBS-1NoWIX1AZS-00oMdr; Fri, 11 Dec 2009 11:33:47 +0100 User-Agent: Thunderbird 2.0.0.19 (X11/20081227) In-Reply-To: <20091210135803.GA8534@tomas> X-Provags-ID: V01U2FsdGVkX19htpG3wdVSD5JJM0HiE8IbSk7d7y7JGVcjjMw cuzKJHQxnXDKm+MZFc2FCWz5Ww16gz4g5s0nKkc1ASH18ZiQgd 5/lDWkHQuzY0WCh1mXZIwxOZav3DH9wBi4dpoBl7gA= X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. 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:70588 Archived-At: tomas@tuxteam.de wrote: > On Thu, Dec 10, 2009 at 01:50:01PM +0100, Andreas Roehler wrote: >> Hi, > >> given a list or a list of lists: >> list shall be returned, if it contains a certain member. > >> 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)) > > > 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ás Hi Tomas, assoc tells, it compares some key and the car of a list: "Return non-nil if KEY is `equal' to the car of an element of LIST." Its related, but slightly different IMO. The form I'm looking for returns list, if an element is member of - equality of whole list returned by car is not at stake. Thanks anyway Andreas