Maximum (UnicodeNamedArraylist function): Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (1 revision)
m (1 revision)
Line 1: Line 1:
<span style="font-size:120%; color:black"><b><section begin=dpl_desc/>Get item that has maximum value<section end=dpl_desc/></b></span>
{{Template:UnicodeNamedArraylist:Maximum subtitle}}
[[Category:UnicodeNamedArraylist methods|Maximum function]]
<!--DPL?? Category:UnicodeNamedArraylist methods|Maximum function: Get item that has maximum value-->
<p>
Maximum is a member of the [[UnicodeNamedArraylist class]].
</p>


This function returns the subscript name of the UnicodeNamedArraylist item
This function returns the subscript name of the UnicodeNamedArraylist item
Line 17: Line 12:
Local methods are discussed in [[??]] refid=localm..
Local methods are discussed in [[??]] refid=localm..
==Syntax==
==Syntax==
  name = %unamrayl:Maximum(function)
{{Template:UnicodeNamedArraylist:Maximum syntax}}
===Syntax Terms===
===Syntax terms===
<dl>
<dl>
<dt><i>name</i>
<dt><i>name</i>
Line 37: Line 32:


</dl>
</dl>
==Usage Notes==
==Usage notes==
<ul>
<ul>
<li>If the function applied by Maximum returns string values, Maximum
<li>If the function applied by Maximum returns string values, Maximum
Line 43: Line 38:
the number of the item that has the greatest value.
the number of the item that has the greatest value.
Therefore, lowercase letters are ranked alphabetically and
Therefore, lowercase letters are ranked alphabetically and
the maximum lowercase letter is &ldquo;z&rdquo;;
the maximum lowercase letter is "z";
the uppercase letters are ranked alphabetically and
the uppercase letters are ranked alphabetically and
the maximum uppercase letter is &ldquo;Z&rdquo;;
the maximum uppercase letter is "Z";
&ldquo;z&rdquo; ranks lower than all the uppercase letters;
"z" ranks lower than all the uppercase letters;
and all letters rank lower than any number.
and all letters rank lower than any number.
<li>If two or more UnicodeNamedArraylist items have equal, maximum, values,
<li>If two or more UnicodeNamedArraylist items have equal, maximum, values,
Line 60: Line 55:
the Minimum method description, and see [[Collections#Finding collection maxima and minima, and sorting|Finding collection maxima and minima, and sorting]].
the Minimum method description, and see [[Collections#Finding collection maxima and minima, and sorting|Finding collection maxima and minima, and sorting]].
</ul>
</ul>
==See also==
{{Template:UnicodeNamedArraylist:Maximum footer}}

Revision as of 19:43, 28 January 2011

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


This function returns the subscript name of the UnicodeNamedArraylist item that has the maximum value after the application of a specified function to each item. The function that gets applied to each UnicodeNamedArraylist item, which you identify in the argument to Maximum, 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". Local methods are discussed in ?? refid=localm..

Syntax

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

Syntax terms

name
A Unicode string to contain the subscript name of the item in the indicated UnicodeNamedArraylist that has the maximum value after the argument function has been applied.
%unamrayl
A UnicodeNamedArraylist object.
function
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 %unamrayl declaration and that returns a numeric or string value. The special identity function, This, is the default function value for the Maximum and Minimum methods. See Using the This function as the Maximum parameter.

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. Therefore, lowercase letters are ranked alphabetically and the maximum lowercase letter is "z"; the uppercase letters are ranked alphabetically and the maximum uppercase letter is "Z"; "z" ranks lower than all the uppercase letters; and all letters rank lower than any number.
  • If two or more UnicodeNamedArraylist items have equal, maximum, values, Maximum returns the subscript of the item that appears closest to the beginning of the UnicodeNamedArraylist.
  • 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. Example "Maximum/Minimum with local method" shows a way to apply ToIntegerPower with Maximum for an Arraylist.
  • The Minimum function is the opposite of the Maximum function.
  • For examples of Maximum (and Minimum) calls, see FloatNamedArraylist Minimum function example in the Minimum method description, and see Finding collection maxima and minima, and sorting.

See also