From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: ishi soichi Newsgroups: gmane.emacs.help Subject: Re: build-in function for obtaining the index of an element of a list Date: Thu, 5 Jan 2012 08:52:17 +0900 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=14dae9340b817334cb04b5bc814d X-Trace: dough.gmane.org 1325721149 19492 80.91.229.12 (4 Jan 2012 23:52:29 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 4 Jan 2012 23:52:29 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Juanma Barranquero Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Jan 05 00:52:25 2012 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Riad6-0000vO-BO for geh-help-gnu-emacs@m.gmane.org; Thu, 05 Jan 2012 00:52:24 +0100 Original-Received: from localhost ([::1]:38919 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Riad5-0006oe-Qe for geh-help-gnu-emacs@m.gmane.org; Wed, 04 Jan 2012 18:52:23 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:41661) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Riad1-0006oX-7h for help-gnu-emacs@gnu.org; Wed, 04 Jan 2012 18:52:19 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Riad0-00089R-6G for help-gnu-emacs@gnu.org; Wed, 04 Jan 2012 18:52:19 -0500 Original-Received: from mail-iy0-f169.google.com ([209.85.210.169]:48725) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Riacz-00089N-QN for help-gnu-emacs@gnu.org; Wed, 04 Jan 2012 18:52:18 -0500 Original-Received: by iacb35 with SMTP id b35so36784665iac.0 for ; Wed, 04 Jan 2012 15:52:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=pRinqksY+9zBbdiYVKDoKHnowTI9dFVy/9kIApDyOlM=; b=lMyvL+aFxD3TmSbBf6333nOjyWgzsxgEdU0wcPiL0KckPoAdg7lDAhLSlZ5Ac1mALY Q2D5uQEQDOndrCIHV0AwJcnRfNJf56p5h+HiqquV4GV6gq0nk3pauxR6TtL0c0+7FqJb 1qHKsRUErqgC0P4UGCe0VtrNWkgvEf7tqse2w= Original-Received: by 10.50.186.169 with SMTP id fl9mr69674358igc.28.1325721137132; Wed, 04 Jan 2012 15:52:17 -0800 (PST) Original-Received: by 10.43.131.138 with HTTP; Wed, 4 Jan 2012 15:52:17 -0800 (PST) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 209.85.210.169 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:83331 Archived-At: --14dae9340b817334cb04b5bc814d Content-Type: text/plain; charset=ISO-8859-1 Thanks. This is what I wanted. soichi 2012/1/4 Juanma Barranquero > > Is there any Emacs built-in function that returns the index of an > element of > > a list? > > If you don't mind using the CL package (included with Emacs), the > function you want is `position' > > (position "banana" '("apple" "banana" "orange") :test 'string=) => 1 > > Juanma > --14dae9340b817334cb04b5bc814d Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Thanks. This is what I wanted.

soichi

2012/1/4 Juanma Barranquero <lekktu@gmail.com>
> Is there any Emacs built-in function that returns th= e index of an element of
> a list?

If you don't mind using the CL package (included with Emacs), the=
function you want is `position'

=A0(position "banana" '("apple" "banana" = "orange") :test 'string=3D) =A0 =3D> =A01

=A0 =A0 Juanma

--14dae9340b817334cb04b5bc814d--