unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Juanma Barranquero <lekktu@gmail.com>
To: ishi soichi <soichi777@gmail.com>
Cc: help-gnu-emacs@gnu.org
Subject: Re: build-in function for obtaining the index of an element of a list
Date: Wed, 4 Jan 2012 13:51:25 +0100	[thread overview]
Message-ID: <CAAeL0STa=f07Re2WyaxRh39GSP7eXgsMFmh+oxZrZYVRLQoOPQ@mail.gmail.com> (raw)
In-Reply-To: <CAEjRLuR0g2wRvhPdt2vGmU4uT6Zn1N9fL_u_Dk1Z3E7FT9EcXQ@mail.gmail.com>

> 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



  reply	other threads:[~2012-01-04 12:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-04  6:33 build-in function for obtaining the index of an element of a list ishi soichi
2012-01-04 12:51 ` Juanma Barranquero [this message]
2012-01-04 23:52   ` ishi soichi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAAeL0STa=f07Re2WyaxRh39GSP7eXgsMFmh+oxZrZYVRLQoOPQ@mail.gmail.com' \
    --to=lekktu@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=soichi777@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).