TJB:

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.

void main() {
    import std.stdio, std.algorithm;

    double[char] bids = ['A': 37.50,
                         'B': 38.11,
                         'C': 36.12];

    bids.byValue.reduce!(min, max).writeln;
}

Bye,
bearophile

Reply via email to