Bug 13467 – A little better std.algorithm.canFind documentation
Status
RESOLVED
Resolution
FIXED
Severity
trivial
Priority
P1
Component
dlang.org
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-09-13T16:03:00Z
Last change time
2014-09-20T20:48:05Z
Keywords
pull
Assigned to
nobody
Creator
bearophile_hugs
Comments
Comment #0 by bearophile_hugs — 2014-09-13T16:03:04Z
In the documentation of std.algorithm.canFind I suggest to add a link/note to "among":
If you want to search among few items the function std.algorithm.among is more efficient.
Comment #1 by hsteoh — 2014-09-18T17:22:19Z
Does "among" work for substrings? I.e., does among("XabcY", "abc", "def") return true? If not, I'm not sure I see the point of mentioning this in the docs for canFind, since they would cover different functionalities.
Comment #2 by bearophile_hugs — 2014-09-18T19:50:31Z
(In reply to hsteoh from comment #1)
> Does "among" work for substrings? I.e., does among("XabcY", "abc", "def")
> return true? If not, I'm not sure I see the point of mentioning this in the
> docs for canFind, since they would cover different functionalities.
I think Phobos functions should have a "Related" section for the related functions. This helps a lot the discoverability of functions.
As example, this Haskell documentation page of the function "head" has a "Related" section that links to the drop, dropWhile, init, last, tail functions.
http://zvon.org/other/haskell/Outputprelude/head_f.html