Skip to content

TakeSmallestBy

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

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