On Wed, Aug 06, 2014 at 05:57:54PM +0000, TJB via Digitalmars-d-learn wrote: > I am trying to find the max and min values in an associative array. Say I > have: > > double[char] bids; > bid['A'] = 37.50; > bid['B'] = 38.11; > bid['C'] = 36.12; > > How can I find the max and min values. I am thinking that I need to use max > and min functions from std.algorithm, but not sure how to. [...]
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 -- Designer clothes: how to cover less by paying more.