Minimum by key function

As far as I know there is no built-in way right now, but 2-arg versions of findmin and argmin are coming in 1.7.

In the mean time:

minimumby(f, iter) = reduce(iter) do x, y
    f(x) < f(y) ? x : y
end
3 Likes