[Issue 4705] Redesign of std.algorithm.max()/min() + mins()/maxs()
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Dec 24 11:14:18 PST 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4705
Denis Derman <denis.spir at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |denis.spir at gmail.com
--- Comment #2 from Denis Derman <denis.spir at gmail.com> 2010-12-24 11:12:14 PST ---
(In reply to comment #0)
> I also suggest to create two new functions, that I have just called maxs() and
> mins() similar to max and min, that find all the max or min items of a given
> collection. They don't need the case with two or three items:
>
> maxs(collection)
> maxs!(callable)(collection)
>
> mins(collection)
> mins!(callable)(collection)
Why I understand the utility of maxs/mins, I wonder about them in std lib.
Aren't they "niche domain" tools?
Also, I wonder about maxs(collection) without any trnasform func: if you don't
map, then there is logically a single max value (even if can occur several
times in collection). maxS/minS seems useful only in presence of a transform
func on which results comparison is done: the compared value is (in your case
string len) unique, but there may be several original values in coll that map
to it.
To say it deifferently, in your case mins(collection) would return possibly
multiple specimens of the same string. And mins(lenghts) would return [5,5].
Unless I misunderstand your point.
Denis
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list