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
Comment #3 by hsteoh — 2014-09-18T19:53:09Z
Good idea! I'll add a Related section to canFind.
Comment #4 by hsteoh — 2014-09-18T20:06:51Z
Done: https://github.com/D-Programming-Language/phobos/pull/2532 Renamed it to "See Also:" instead, since that is what is used by the ddocs of a few other functions in std.algorithm.
Comment #5 by github-bugzilla — 2014-09-19T00:57:25Z
Commits pushed to master at https://github.com/D-Programming-Language/phobos https://github.com/D-Programming-Language/phobos/commit/0b6bfd5aa73ef134659f21d36e7f1b7f0d2cfe5f Cross-reference `among` from `canFind`. For newbies' ease of discovering the right function to use (issue 13467). https://github.com/D-Programming-Language/phobos/commit/bf4cadbb4b4f393a2ab4b6f9e86e8e3c9650f94c Merge pull request #2532 from quickfur/issue13467 Cross-reference `among` from `canFind`.
Comment #6 by github-bugzilla — 2014-09-20T20:48:05Z