Maximum (FloatNamedArraylist function): Difference between revisions
m (match syntax table to diagram, tags and edits) |
m (few more tags) |
||
Line 1: | Line 1: | ||
{{Template:FloatNamedArraylist:Maximum subtitle}} | {{Template:FloatNamedArraylist:Maximum subtitle}} | ||
<var>Maximum</var> returns the number (subscript) of the <var>FloatNamedArraylist</var> item that has the maximum value after the application of a specified function to each item. The function | <var>Maximum</var> returns the number (subscript) of the <var>FloatNamedArraylist</var> item that has the maximum value after the application of a specified function to each item. The function applied to each <var>FloatNamedArraylist</var> item, which you specify with the required <var class="term">itemFunction</var> argument, must be a method that operates on the item type and returns a User Language [[Intrinsic classes|intrinsic]] datatype (<var>Float</var>, <var>String</var>, <var>Longstring</var>, or <var>Unicode</var>) value. | ||
==Syntax== | ==Syntax== | ||
Line 14: | Line 13: | ||
<tr><th>itemFunction</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 <var class="term">fltNal</var> 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">fltNal</var> declaration and that returns a numeric or string value. | ||
<p>As of <var class="Product">"Sirius Mods"</var> Version 7.6, the special identity function, <var>This</var>, is the default <var class="term">itemFunction</var> value for the Maximum and Minimum methods. See [[Collections#Using the This function as the Maximum parameter|"Using the This function as the Maximum parameter"]] for more information.</p></td></tr> | <p>As of <var class="Product">"Sirius Mods"</var> Version 7.6, the special identity function, <var>This</var>, is the default <var class="term">itemFunction</var> value for the <var>Maximum</var> and <var>Minimum</var> methods. See [[Collections#Using the This function as the Maximum parameter|"Using the This function as the Maximum parameter"]] for more information.</p></td></tr> | ||
</table> | </table> |
Revision as of 10:15, 8 March 2011
Name of item with maximum value or maximum value of function applied to items (FloatNamedArraylist class)
Maximum returns the number (subscript) of the FloatNamedArraylist item that has the maximum value after the application of a specified function to each item. The function applied to each FloatNamedArraylist 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, Longstring, or Unicode) value.
Syntax
%number = fltNal:Maximum[( [itemFunction])]
Syntax terms
%number | A numeric variable to contain the subscript number of the item in the indicated FloatNamedArraylist that has the maximum value after the argument function has been applied. |
---|---|
%fntNal | A FloatNamedArraylist 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 fltNal declaration and that returns a numeric or string value.
As of "Sirius Mods" Version 7.6, 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" for more information. |
Usage notes
- If the function applied by Maximum returns string values, Maximum uses the decimal-equivalent value of the character bytes and determines the number of the item that has the greatest value. Lowercase letters are first ranked alphabetically; then uppercase letters, also ranked alphabetically; finally followed by the numbers; that is:
'a'..'z','A'..'Z',0..9
. - If two or more FloatNamedArraylist items have equal, maximum, values, Maximum returns the position of the item that appears closest to the beginning of the FloatNamedArraylist.
- The parameter for Maximum 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 Maximum parameter. The "Maximum and Minimum with local method" example shows a way to apply ToIntegerPower with Maximum.
- Maximum is available in "Sirius Mods" Version 7.3 and later.
Examples
- For examples of Maximum(and Minimum) calls, see the "FloatNamedArraylist Minimum function example" in the Minimum method description, and "Finding collection maxima and minima, and sorting".
See also
- Minimum is the opposite of the Maximum function.