Say I am tabling the values of a two variable function using a list of indexes (which I can't assume to be ordered), I'd like to return the index (or the list of indexes) which yield the maximum value(s) for one of the two arguments (supplying the other one externally.
indexes = {1,5,19,3,2,14};
f[x_,y_] := someFunc[x,y];
(* Just a place holder, any function returning integers should do, if there are multiple maxima I'd like a list in return and I'll break ties later. *)
ArgMax[Table[ f[x,y],{x,indexes}]];
MaximalBy
the answer? $\endgroup$MaximalFunc[list_,y_] := MaximalBy[list,f[y,#2]];
$\endgroup$MaximalBy[indexes, f[#, externalVar, ...]&]
$\endgroup$