[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: until-found
From: |
Andreas Röhler |
Subject: |
Re: until-found |
Date: |
Fri, 11 Dec 2009 18:35:33 +0100 |
User-agent: |
Thunderbird 2.0.0.19 (X11/20081227) |
Helmut Eller wrote:
> * Andreas Roehler [2009-12-10 13:50+0100] writes:
>
>> And here my implementation so far:
>>
>> (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))
>
> This seems to be the same as:
>
> (car (member (lambda (element) (member search-string element)) liste))
>
> or
>
> (find-if (lambda (element) (member search-string element)) liste)
>
> or
>
> (find search-string liste :test #'member)
>
> or
>
> (loop for e in liste if (member search-string e) return e)
>
> Helmut
>
Ah, fine stuff, thanks a lot!
Andreas