Skip Menu |
 

This queue is for tickets about the List-MoreUtils CPAN distribution.

Report information
The Basics
Id: 120666
Status: rejected
Priority: 0/
Queue: List-MoreUtils

People
Owner: Nobody in particular
Requestors: PETDANCE [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.416
Fixed in: (no value)



Subject: onlyval has incomplete documentation
Download (untitled) / with headers
text/plain 473b
Docs for onlyval/only_value say: Returns the only element in LIST for which BLOCK evaluates to true. Sets C<$_> for each item in LIST in turn. Returns C<undef> if no such element has been found. Based on the name of the function I would expect that last sentence to be Returns C<undef> if no such element has been found, or if more than one such element has been found. That's what I'm seeing in List::MoreUtils::PP. The other onlyxxx functions have this same problem.
Download (untitled) / with headers
text/plain 904b
On Mon Mar 20 15:46:23 2017, PETDANCE wrote: Show quoted text
> Docs for onlyval/only_value say: > > Returns the only element in LIST for which BLOCK evaluates to true. > Sets > C<$_> for each item in LIST in turn. Returns C<undef> if no such > element > has been found. > > Based on the name of the function I would expect that last sentence to > be > > Returns C<undef> if no such element has been found, or if more than > one such element has been found. > > That's what I'm seeing in List::MoreUtils::PP. > > The other onlyxxx functions have this same problem.
The "or if more than one element has been found" is implicit: "Returns the only element in LIST for which BLOCK evaluates to true." really means returns the ONLY element ... - when there would be more than one element, for whicht the block evaluates true, than it's not the only one. Try to rephase with singleton and distinct in mind. Cheers, Jens


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.