The module listsprovides a function for finding the maximum list lists:max(List).
Is there a type function lists:maxfun(Fun, List)? This fun should be used for all elements, but maxfunshould return this element instead of a value. For instance:
Fun gets [X,Y] and calcs X+Y
lists:maxfun(Fun,[[1,1],[1,2]]} -> [1,2].
source
share