up previous next
MinBy

a minimum element of a list

Syntax
MinBy(L: LIST, LessThanFunc: FUNCTION)

Description
This function return a minimum of the elements of the list in L with respect to the comparisons made by LessThanFunc. (see MaxBy for details)

Example
/**/  Define ByLength(S, T)    -- define the sorting function
/**/    Return len(S) < len(T);
/**/  EndDefine;

/**/  L := ["bird", "mouse", "cat", "elephant"];
/**/  MinBy(L, ByLength);
cat

See Also