new functions to return the element of l that maximizes f.