[Top][All Lists]

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

Re: seq-some-p and nil

From: Nicolas Petton
Subject: Re: seq-some-p and nil
Date: Tue, 08 Sep 2015 09:09:57 +0200
User-agent: Notmuch/0.19 (http://notmuchmail.org) Emacs/ (x86_64-unknown-linux-gnu)

Stefan Monnier <address@hidden> writes:

>>> Returning what FUN returned seems like a better choice.
>>> If you need the element matched, then you can simply arrange for FUN
>>> to return the element.
>> There is a misunderstanding here I think.
>> The way I see it, they are two different functions: the (new) seq-some,
>> and this other function that is now missing in seq, with the new
>> implementation of `seq-some'.
> I don't think so.  Both functions can be one and the same.
> If you really want seq-find, you can define it as
>   (defun seq-find (pred seq)
>     (seq-some (lambda (x) (and (funcall pred x) x)) seq))
> But I'm far from convinced it's worth having them both,

Can you elaborate on why you think it's not worth it?

IMO, finding an element in a sequence is a very common operation, and to
do that now with `seq-some' one would have to add extra code to the
lambda each time, which I find cumbersome, but more importantly is not
very good in terms of code reuse.

Nicolas Petton

Attachment: signature.asc
Description: PGP signature

reply via email to

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