unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: [Emacs-diffs] master 8aa0386: Add seq-find
       [not found] ` <E1ZaA2i-0006EL-32@vcs.savannah.gnu.org>
@ 2015-09-11 13:45   ` Stefan Monnier
  2015-09-11 13:56     ` Pip Cet
  2015-09-13 14:09     ` Nicolas Petton
  0 siblings, 2 replies; 4+ messages in thread
From: Stefan Monnier @ 2015-09-11 13:45 UTC (permalink / raw)
  To: emacs-devel; +Cc: Nicolas Petton

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


        Stefan



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Emacs-diffs] master 8aa0386: Add seq-find
  2015-09-11 13:45   ` [Emacs-diffs] master 8aa0386: Add seq-find Stefan Monnier
@ 2015-09-11 13:56     ` Pip Cet
  2015-09-13 14:10       ` Nicolas Petton
  2015-09-13 14:09     ` Nicolas Petton
  1 sibling, 1 reply; 4+ messages in thread
From: Pip Cet @ 2015-09-11 13:56 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Nicolas Petton, emacs-devel

[-- Attachment #1: Type: text/plain, Size: 1341 bytes --]

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 <monnier@iro.umontreal.ca>
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.
>
>
>         Stefan
>
>

[-- Attachment #2: Type: text/html, Size: 1918 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Emacs-diffs] master 8aa0386: Add seq-find
  2015-09-11 13:45   ` [Emacs-diffs] master 8aa0386: Add seq-find Stefan Monnier
  2015-09-11 13:56     ` Pip Cet
@ 2015-09-13 14:09     ` Nicolas Petton
  1 sibling, 0 replies; 4+ messages in thread
From: Nicolas Petton @ 2015-09-13 14:09 UTC (permalink / raw)
  To: Stefan Monnier, emacs-devel

[-- Attachment #1: Type: text/plain, Size: 752 bytes --]

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> +  "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.

Thanks, I'll improve the docstring.

Nico
-- 
Nicolas Petton
http://nicolas-petton.fr

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 512 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Emacs-diffs] master 8aa0386: Add seq-find
  2015-09-11 13:56     ` Pip Cet
@ 2015-09-13 14:10       ` Nicolas Petton
  0 siblings, 0 replies; 4+ messages in thread
From: Nicolas Petton @ 2015-09-13 14:10 UTC (permalink / raw)
  To: Pip Cet, Stefan Monnier; +Cc: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 506 bytes --]

Pip Cet <pipcet@gmail.com> writes:

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

You are right, it would be both more consistent and a better name, I'll
fix that.

Nico
-- 
Nicolas Petton
http://nicolas-petton.fr

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 512 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-09-13 14:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20150910221007.23863.13601@vcs.savannah.gnu.org>
     [not found] ` <E1ZaA2i-0006EL-32@vcs.savannah.gnu.org>
2015-09-11 13:45   ` [Emacs-diffs] master 8aa0386: Add seq-find Stefan Monnier
2015-09-11 13:56     ` Pip Cet
2015-09-13 14:10       ` Nicolas Petton
2015-09-13 14:09     ` Nicolas Petton

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).