From: tomas@tuxteam.de
To: Andreas Roehler <andreas.roehler@online.de>
Cc: help-gnu-emacs@gnu.org
Subject: Re: until-found
Date: Thu, 10 Dec 2009 14:58:03 +0100 [thread overview]
Message-ID: <20091210135803.GA8534@tomas> (raw)
In-Reply-To: <4B20EE79.607@online.de>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
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
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
iD8DBQFLIP5rBcgs9XrR2kYRAjsjAJwNovO3/6lB59xeqk6ueXZ+JfA4zQCfX0Xm
4UhpD99BTnp9HIZcVqDb97s=
=+rTv
-----END PGP SIGNATURE-----
next prev parent reply other threads:[~2009-12-10 13:58 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-10 12:50 until-found Andreas Roehler
2009-12-10 13:58 ` tomas [this message]
2009-12-11 10:33 ` until-found Andreas Röhler
[not found] <mailman.12661.1260449426.2239.help-gnu-emacs@gnu.org>
2009-12-11 16:10 ` until-found Helmut Eller
2009-12-11 17:35 ` until-found Andreas Röhler
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=20091210135803.GA8534@tomas \
--to=tomas@tuxteam.de \
--cc=andreas.roehler@online.de \
--cc=help-gnu-emacs@gnu.org \
/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).