Minimum (NamedArraylist function): Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (1 revision)
mNo edit summary
Line 1: Line 1:
{{Template:NamedArraylist:Minimum subtitle}}
{{Template:NamedArraylist:Minimum subtitle}}


This function returns the name (subscript) of the NamedArraylist item that has
This function returns the name (subscript) of the <var>NamedArraylist</var> item that has
the minimum value after the application of a specified function to each item.
the minimum value after the application of a specified function to each item.
The function that gets applied to each NamedArraylist item, which
The function that gets applied to each <var>NamedArraylist</var> item, which
you identify in the argument to Minimum, must be a method
you identify in the argument to <var>Minimum</var>, must be a method
that operates on the item type and returns a User Language intrinsic
that operates on the item type and returns a User Language intrinsic
datatype (Float, String, Longstring, or Unicode) value.
datatype (Float, String, Longstring, or Unicode) value.


The system intrinsic classes are discussed in [[Intrinsic classes|"Intrinsic classes"]].
The system intrinsic classes are discussed in [[Intrinsic classes|"Intrinsic classes"]], and
Local methods are discussed in [[??]] refid=localm..
Local methods are disscussed in [[Local and Common entities|"Local and Common entities"]].


Minimum is available in <var class="product">Sirius Mods</var> version 7.3 and later.
<var>Minimum</var> is available in <var class="product">Sirius Mods</var> version 7.3 and later.
==Syntax==
==Syntax==
{{Template:NamedArraylist:Minimum syntax}}
{{Template:NamedArraylist:Minimum syntax}}
===Syntax terms===
===Syntax terms===
<table class="syntaxTable">
<table class="syntaxTable">
<tr><th>%str</th>
<tr><th>%string</th>
<td>A string variable to contain the subscript name of the item in the indicated NamedArraylist that has the minimum value after the argument function has been applied. </td></tr>
<td>A string variable to contain the subscript name of the item in the <var class="term">nal</var> method object <var>NamedArraylist</var> that has the minimum value after the argument function has been applied. </td></tr>
<tr><th>%namrayl</th>
<tr><th>nal</th>
<td>A NamedArraylist object. </td></tr>
<td>A <var>NamedArraylist</var> object. </td></tr>
<tr><th>function</th>
<tr><th>itemFunction</th>
<td>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 ''%narrayl'' declaration and that returns a numeric or string value.
<td>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 <var class="term">nal</var> declaration and that returns a numeric or string value.


As of <var class="product">Sirius Mods</var> version 7.6, the special identity function, <tt>This</tt>, is the default ''function'' value for the Minimum and Maximum methods. See [[Collections#Using the This function as the Maximum parameter|"Using the This function as the Maximum parameter"]].</td></tr>
As of <var class="product">Sirius Mods</var> version 7.6, the special identity function, <tt>This</tt>, is the default ''function'' value for the Minimum and Maximum methods. See [[Collections#Using the This function as the Maximum parameter|"Using the This function as the Maximum parameter"]].</td></tr>

Revision as of 12:22, 8 February 2012

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


This function returns the name (subscript) of the NamedArraylist item that has the minimum value after the application of a specified function to each item. The function that gets applied to each NamedArraylist item, which you identify in the argument to Minimum, must be a method that operates on the item type and returns a User Language intrinsic datatype (Float, String, Longstring, or Unicode) value.

The system intrinsic classes are discussed in "Intrinsic classes", and Local methods are disscussed in "Local and Common entities".

Minimum is available in Sirius Mods version 7.3 and later.

Syntax

%string = nal:Minimum[( [itemFunction])]

Syntax terms

%string A string variable to contain the subscript name of the item in the nal method object NamedArraylist that has the minimum value after the argument function has been applied.
nal A NamedArraylist 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 nal declaration and that returns a numeric or string value. As of Sirius Mods version 7.6, the special identity function, This, is the default function value for the Minimum and Maximum methods. See "Using the This function as the Maximum parameter".

Usage notes

  • If the function applied by Minimum returns string values, Minimum uses the decimal-equivalent value of the character bytes and determines the number of the item that has the lowest value. Therefore, lowercase letters are ranked alphabetically and the minimum lowercase letter is "a"; the uppercase letters are ranked alphabetically and the minimum uppercase letter is "A"; "z" ranks lower than all the uppercase letters; and all letters rank lower than any number.
  • If one or more NamedArraylist items have equal, minimum, values, Minimum returns the name of the item that appears closest to the beginning of the NamedArraylist.
  • The Maximum function is the opposite of the Minimum function.
  • The parameter for Minimum 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 the Minimum parameter. Example "Maximum/Minimum with local method" shows a way to apply ToIntegerPower with the Maximum or Minimum method for an Arraylist.
  • For an example of the Minimum method for a NamedArraylist, see "NamedArraylist Maximum function example", and also see "Finding collection maxima and minima, and sorting".

See also