From: "Andreas Röhler" <andreas.roehler@easy-emacs.de>
To: tomas@tuxteam.de
Cc: help-gnu-emacs@gnu.org
Subject: Re: until-found
Date: Fri, 11 Dec 2009 11:33:42 +0100 [thread overview]
Message-ID: <4B222006.10305@easy-emacs.de> (raw)
In-Reply-To: <20091210135803.GA8534@tomas>
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
next prev parent reply other threads:[~2009-12-11 10:33 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 ` until-found tomas
2009-12-11 10:33 ` Andreas Röhler [this message]
[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=4B222006.10305@easy-emacs.de \
--to=andreas.roehler@easy-emacs.de \
--cc=help-gnu-emacs@gnu.org \
--cc=tomas@tuxteam.de \
/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).