The Function: Grade Up - IBM 5100 Apl Reference Manual

Hide thumbs Also See for 5100:
Table of Contents

Advertisement

The
4>
Function: Grade Up
OJ OJ
The
~symbol
is formed by overstriking the 11 symbol and the
I
symbol.
Monadic (One-Argument) Form: Grade Up
~B
The grade up function result is the index values that would select the elements of
argument B in ascending order. That is, the first element of the result is the index
of the smallest element in argument B, the next element is the index of the next
smallest element in argument B, and so on. Argument B must be a numeric vector.
When two or more elements in the vector have the same numeric value, their posi-
tion in the yector determines their order in the result (the index value of the first
occurrence appears first in the output). The number of elements in the result is the
same as the number of elements in the argument:
.$3 1-
I!!'
... 1
2
I.f.
"~)
'+
1
C'
3
.....
.J
4tAt-6
2
~5
:I. 1+
:~
4-
2 6
-5 3 1
ib:3
6
:~
:I.
~5
::!
L~
6 :I. 3 5
r>
.:-
The following example shows how the grade up function can be used to sort a vec-
tor into ascending order:
At-:l.~
12 16 18 15 1:1.
A [¢.AJ
11 12
1~
15 16 :1.8
The result of the grade up function is not the reverse of the grade down function
because of the way equal elements are handled; see The
' W Function: Grade Down
for an example uSing the grade up and grade down functions with equal elements.
Note: The result of the
~
function depends on the 010 system variable (see
Chap~
ter 5 for information on the 010 system variable).
Dyadic (Two-Argument) Form
There is no dyadic form.
83

Advertisement

Table of Contents
loading

Table of Contents