Minimum (UnicodeNamedArraylist function): Difference between revisions
m (1 revision) |
m (→Usage notes) |
||
(15 intermediate revisions by 5 users not shown) | |||
Line 1: | Line 1: | ||
{{Template:UnicodeNamedArraylist:Minimum subtitle}} | {{Template:UnicodeNamedArraylist:Minimum subtitle}} | ||
<var>Minimum</var> returns the name of the <var>UnicodeNamedArraylist</var> item that has the minimum value as returned by a specified function. The function applied to each <var>UnicodeNamedArraylist</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 <var class="product">User Language</var> [[Intrinsic classes|intrinsic]] datatype (<var>Float</var>, <var>String</var>, or <var>Unicode</var>) value. | |||
has the minimum value | |||
The function | |||
you | |||
that operates on the item type and returns a User Language intrinsic | |||
datatype (Float, String | |||
==Syntax== | ==Syntax== | ||
{{Template:UnicodeNamedArraylist:Minimum syntax}} | {{Template:UnicodeNamedArraylist:Minimum syntax}} | ||
===Syntax terms=== | ===Syntax terms=== | ||
< | <table class="syntaxTable"> | ||
< | <tr><th>%unicode</th> | ||
< | <td>A Unicode variable to contain the name of the item in the indicated <var>UnicodeNamedArraylist</var>that has the minimum value as returned by the argument function. </td></tr> | ||
item in the indicated UnicodeNamedArraylist that has the minimum value | <tr><th>uniNal</th> | ||
<td>A <var>UnicodeNamedArraylist</var> object. </td></tr> | |||
< | <tr><th>itemFunction</th> | ||
< | <td>A method value (a method name literal, a [[Method variables|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">uniNal</var> declaration and that returns an intrinsic value. | ||
< | |||
< | 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 <var>This</var> function as the Maximum parameter"]].</td></tr> | ||
or even a method that returns a method value) for a method | |||
that operates on objects of the type specified on the | </table> | ||
declaration and that returns a numeric or | |||
==Usage notes== | |||
<ul> | |||
<li>If <var class="term">itemFunction</var> returns <var>String</var> or <var>Unicode</var> values, <var>Minimum</var> uses the collating sequence of EBCDIC or Unicode, respectively, to determine which item has the least value. If <var class="term">itemFunction</var> returns a numeric type, numeric comparisons are used. See the [[Minimum (NamedArraylist function)#Examples|"example"]] for the <var>NamedArraylist</var> <var>Minimum</var> function. | |||
<li>If the values returned by <var class="term">itemFunction</var> for two or more <var>UnicodeNamedArraylist</var> items are equal, minimum, values, <var>Minimum</var> returns the name of that item which is closest to the beginning of the <var>UnicodeNamedArraylist</var>. | |||
<li>The [[Maximum (UnicodeNamedArraylist function)|Maximum]] function is the opposite of the <var>Minimum</var> function. | |||
< | <li>The <var class="term">itemFunction</var> argument is a method value, not a <var class="product">User Language</var> expression. | ||
= | |||
" | |||
< | |||
That is, you cannot provide a function that itself has an argument | That is, you cannot provide a function that itself has an argument | ||
(say, < | (say, <code>ToIntegerPower(2)</code>) as <var class="term">itemFunction</var>. | ||
Example | Example [[Maximum (Arraylist function)|"Maximum/Minimum with local method"]] shows a way to apply <var>[[ToIntegerPower (Float function)|ToIntegerPower]]</var> | ||
with Maximum or Minimum for an Arraylist. | with <var>Maximum</var> or <var>Minimum</var> for an <var>Arraylist</var>. | ||
</ul> | </ul> | ||
==Examples== | |||
For examples of <var>Minimum</var> (and <var>Maximum</var>) calls, see the [[Minimum (FloatNamedArraylist function)#Examples|"FloatNamedArraylist Minimum function example"]] in | |||
the <var>Minimum</var> method description, and [[Collections#Finding collection maxima and minima, and sorting|"Finding collection maxima and minima, and sorting"]], and the [[Maximum (NamedArraylist function)#Examples|"NamedArraylist Maximum function example"]]. | |||
==See also== | ==See also== | ||
{{Template:UnicodeNamedArraylist:Minimum footer}} | {{Template:UnicodeNamedArraylist:Minimum footer}} |
Latest revision as of 20:35, 1 November 2012
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".