This is a side effect of min/max/minmax not using an iterator approach atm. I’m looking at making the necessary modifications, but that will be later today at the soonest.
> On 30 Jul 2016, at 11:47, Sam S. (via RT) <[email protected]> > wrote: > > # New Ticket Created by Sam S. > # Please include the string: [perl #128780] > # in the subject line of all future correspondence about this issue. > # <URL: https://rt.perl.org/Ticket/Display.html?id=128780 > > > > Currently, calling .min or .max on an non-empty Hash throws a spurious error: > > ➜ say {a=>3, b=>2, c=>1}.max(*.value); > Index out of range. Is: 1, should be in 0..0 > > ➜ say {a=>3, b=>2, c=>1}.min(*.value); > Index out of range. Is: 1, should be in 0..0 > > I think they should operate on the Hash is list context (i.e. make .max work > like .list.max, and .min like .list.min). > > That's what other list'y methods already do when they're used on a Hash: > > ➜ say {a=>3, b=>2, c=>1}.grep(*.value == 3); > (a => 3) > > ➜ say {a=>3, b=>2, c=>1}.sort(*.value) > (c => 1 b => 2 a => 3)
