help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: until-found


From: tomas
Subject: Re: until-found
Date: Thu, 10 Dec 2009 14:58:03 +0100
User-agent: Mutt/1.5.15+20070412 (2007-04-11)

-----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-----




reply via email to

[Prev in Thread] Current Thread [Next in Thread]