Max/Min values in an associative array

H. S. Teoh via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Aug 15 10:41:25 PDT 2014


On Fri, Aug 15, 2014 at 04:51:59PM +0000, monarch_dodra via Digitalmars-d-learn wrote:
> On Wednesday, 6 August 2014 at 18:07:08 UTC, H. S. Teoh via
> Digitalmars-d-learn wrote:
> >
> >	import std.algorithm : reduce, max, min;
> >
> >	auto highest = reduce!((a,b) => max(a,b))(-double.max, bids.byValue());
> >	auto lowest = reduce!((a,b) => min(a,b))(double.max, bids.byValue());
> >
> >
> >T
> 
> Take a look at Justin Whear's dpaste. Dual pred reduce FTW.

Yeah I saw that. Learned something new. :-)


T

-- 
Bare foot: (n.) A device for locating thumb tacks on the floor.


More information about the Digitalmars-d-learn mailing list