Skip to content

TakeLargestBy

Returns the n largest elements of a list by a key function.

$ wo 'TakeLargestBy[{1, -3, 2, -4, 5}, Abs, 2]'
{5, -4}