emacs-devel
[Top][All Lists]
Advanced

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

Re: seq-some-p and nil


From: Stefan Monnier
Subject: Re: seq-some-p and nil
Date: Tue, 08 Sep 2015 16:33:07 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

>>>> then in most cases, I think the code ends up just as simple with
>>>> seq-some as with seq-find.
>> [...]
>>> To make things easier to understand, I'm taking the example of finding
>>> the first odd number in a seq:
>> I've never needed to do that.
> That was just an example.  You never needed to find an element from
> a sequence?

On its own, no; only to do something with it.  So I think in many cases
you can cheaply move the equivalent of (and <pred> x) into the seq-some
search, in many other cases you can instead cheaply move the processing
of the result into the seq-some search.

Of course, there are still remaining cases where you'll end up needing
(lambda (x) (if (my-pred x) x)), but in my experience, it's not frequent
enough to make a seq-find useful.

This said, we have lots of such functions I find useless, so don't let
that prevent you from adding it to seq.el.  Just don't forget to warn
about its little semantic problem with nil in the docstring.


        Stefan



reply via email to

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