[Top][All Lists]

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

Re: [Emacs-diffs] master 8aa0386: Add seq-find

From: Pip Cet
Subject: Re: [Emacs-diffs] master 8aa0386: Add seq-find
Date: Fri, 11 Sep 2015 13:56:51 +0000

I think it would be best to make the documentation (and variable naming) for this as similar as possible to that of `gethash', which also has a default argument. In particular, I think "default" is a better thing to call it than "sentinel", though it's more important to call it the same thing in both contexts.

On Fri, Sep 11, 2015 at 1:45 PM, Stefan Monnier <address@hidden> wrote:
>     Add seq-find
>     This function is similar to `seq-some' but returns the found element.
>     In the cases where nil can be the found element, a sentinel optional
>     argument can be provided to avoid ambiguities.

This text was not needed here.  It's already present in the code (where
it belongs).

> +  "Return the first element for which (PRED element) is non-nil in SEQ.
> +If no element is found, return SENTINEL or nil.

  "return SENTINEL or nil" should be just "return SENTINEL".

Not only it's shorter, but it's also more precise (the current text
doesn't say when it returns SENTINEL and when it returns nil).

> +Note that `seq-find' has an ambiguity if the found element is nil
> +and if no SENTINEL is specified, as it cannot be known if an
> +element was found or not."

It's not just for nil but for the case where the found value is
identical to SENTINEL.


reply via email to

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