Minimum (UnicodeNamedArraylist function)

From m204wiki
Jump to navigation Jump to search

Name of item with minimum value or minimum value of function applied to items (UnicodeNamedArraylist class)


Minimum returns the name of the UnicodeNamedArraylist item that has the minimum value as returned by a specified function. The function applied to each UnicodeNamedArraylist item, which you specify with the required itemFunction argument, must be a method that operates on the item type and returns a User Language intrinsic datatype (Float, String, or Unicode) value.

Syntax

%unicode = uniNal:Minimum[( [itemFunction])]

Syntax terms

%unicode A Unicode variable to contain the name of the item in the indicated UnicodeNamedArraylistthat has the minimum value as returned by the argument function.
uniNal A UnicodeNamedArraylist object.
itemFunction A method value (a method name literal, a method variable, or even a method that returns a method value) for a method that operates on objects of the type specified on the uniNal declaration and that returns an intrinsic value. The special identity function, This, is the default itemFunction value for the Maximum and Minimum methods. See "Using the This function as the Maximum parameter".

Usage notes

  • If itemFunction returns String or Unicode values, Minimum uses the collating sequence of EBCDIC or Unicode, respectively, to determine which item has the least value. If itemFunction returns a numeric type, numeric comparisons are used. See the "example" for the NamedArraylist Minimum function.
  • If the values returned by itemFunction for two or more UnicodeNamedArraylist items are equal, minimum, values, Minimum returns the name of that item which is closest to the beginning of the UnicodeNamedArraylist.
  • The Maximum function is the opposite of the Minimum function.
  • The itemFunction argument is a method value, not a User Language expression. That is, you cannot provide a function that itself has an argument (say, ToIntegerPower(2)) as itemFunction. Example "Maximum/Minimum with local method" shows a way to apply ToIntegerPower with Maximum or Minimum for an Arraylist.

Examples

For examples of Minimum (and Maximum) calls, see the "FloatNamedArraylist Minimum function example" in the Minimum method description, and "Finding collection maxima and minima, and sorting", and the "NamedArraylist Maximum function example".

See also