Changed maxByN/minByN signature to use two param lists: maxByN(n)(f)