Add a 2-arg flavor, argmax(f, domain)


#1

With the rename to argmax, and dims now a kwarg, it seems very tempting to me to define a 2-arg flavor, argmax(f, domain).

This would be equivalent to x[argmax(f(x) for x=x)] but argmax(f, x) is just so nice. Here, x could be any iterable and argmax(f, x) would quite literally implement the mathematical definition of argmax. Has this been considered?


#2

Seems like a good idea. Would you be willing to open an issue or make a PR?


#3

Ok I’ve filed an issue to at least get the ball rolling. I will try to make a PR. Naively, it seems like a good first issue (second issue? I think it makes sense for argmax to support generators first). Maybe someone will beat me to it, but I’ll give it a shot.


#4

What is domain here?


#5

The iterable x.