Tímarit Verkfræðingafélags Íslands - 01.12.1974, Side 14
.Language, er út kom árið 1962.
APL er all frábrugðið öðrum for-
ritunarmálum, en er mjög auðlært.
Byrjandi getur, þótt hann hafi aðeins
lært mjög takmarkaðan hluta máls-
ins, byrjað að nota það til lausnar á
verkefnum. Síðan getur hann aukið
þekkingu sína smátt og smátt eftir
því sem þörf krefur.
Á mynd 1 er sýnt lyklaborð APL
fjarritans og er það eins og á venju-
legri rafmagnsritvél nema hvað tákn-
in á lyklunum eru önnur. Flest tákn-
in á neðri hluta lyklanna eru tölu-
stafir og stórir bókstaðir en á efri
hluta lyklanna eru flest táknin, ný
og áður óþekkt.
öll táknin svara til reikniaðgerða,
sem byggðar eru inn í tölvukerfið,
einnig eru til aðgerðir, sem fengnar
eru fram með því að slá saman tveim
táknum. Á mynd 2 er gefið yfirlit
yfir allar reikniaðgerðir og tilsvar-
andi tákn. Ekki verða hér útskýrðar
frekar hinar ýmsu aðgerðir umfram
það sem gert er á myndinni, en vís-
að til einhverra þeirra bóka, sem
gefnar eru upp í lok greinarinnar.
Aðgerðir á vektorum og fylkjum
eru mjög einfaldar og afkastamikl-
Scalar Dyadic Functions
Scalar Monadic Functions
Mixed Functions
x+y
X-Y
X*Y
XiY
X*Y
X\ Y
XIY
X\Y
X*>Y
x! y
XOY
X<Y
XZY
x=y
XZY
X>Y
X*Y
*a y
yvy
X«Y
Arvy
X plus Y
X minus Y
X times Y
X divided by Y
X to the Y-th power
maximum of X and Y
minimum of X and Y
X-residue of Y (see Table 4)
base-X logarithm of Y
binomial coefficient; for integer X
and Y, the number of combinations
of Y things taken X at a time
circular and hyperbolic functions
and their inverses (Y is in radians)
(see Table 1)
X less than Y
X less than or equal to Y
X equal to Y
X greater than or equal to Y
X greater than Y
X not equal to Y
X and Y
Xor Y
not both X and Y (X nand Y)
neither X nor Y
(See Table 3)
+ y Y
-y o-y
*y signof Y (-1, 0, 1)
i Y reciprocal of Y
* y e to the Y-th power
T y ceiling of Y
L y floor of Y
| y magnitude of Y
®y natural logarithm of Y
! y factorial Y; Gamma
function of Y + 1
oy v times Y
?Y a random integer from the
vector i Y
~y not Y
result
0 if it
is 1 if the relation holds,
does not
Ooy (1-Y*2)*.5
loy sin Y
2oy cos Y
3oy tan Y
uoy (1+Y*2)*.5
5oy sinh Y
6oy cosh Y
7oy tanh Y
inverse functions are given by negative
values of X, i.e. loy = arcsin Y.
Table 1
X y A a y xvy X*Y Avy
0 0 0 0 1 1
0 í 0 1 1 0
1 0 0 í 1 0
1 í 1 1 0 0
Table 2
y ry U
3.14 4 3
3.14 ” 3 4
Table 3
X\X
x*o X X X X X
x-o y
xpy
py
XÍYH
X\Y
i y
XeY
XtY
XiY
X?Y
A4>y
A4>czjy
XQY
4>y
4>[zjy
ey
X$Y
$y
XtY
,y
X\Y
XiY
X+Y
4A
Reshape Y to have dimension X
Dimension of Y
The elements of X at locations Y
First location of Y within vector X
The first Y consecutive integers from Origin (0 or 1 as
set by set origin command)
Each element of X c Y is 1 or 0 if the corresponding
element of X is or is not some element of Y
Representation of Y in number system X
Value of the representation Y in number system X
X integers selected randomly without repetition from iY
Rotation by X along the last dimension of Y
Rotation by X along the Zth dimension of Y
Rotation by X along the first dimension of Y
Reversal along the last dimension of Y
Reversal along the Zth dimension of Y
Reversal along the first dimension of Y
Transpose by X of the coordinates of Y
Ordinary transpose of Y
Y catenated to X
Ravel of Y (make Y a vector)
I If X positive take first X elements of Y
Mf X negative take last |X elements of Y
I If X positive leave first X elements of Y
I If X negative leave last IX elementsofY
X specified by Y
The indices of values of the vector X in sorted ascending
order
The indices of values of the vector X in sorted descending
order
Null
See Program Definition Section
Comment
In the entries below o stands for ''any scalar dyadic
operator"
Generalized Reduction
i.e., insert the symbol o between each pair of elements
of Y
Table 4
Special Symbols
) Parentheses. Expressions may be of any complexity and are executed from
right to left except as indicated by parentheses.
< Branch to X, where X is a scalar or vector. If X is an empty vector, go to
the next line in sequence. If X is not in the range of statement numbers in
the function, leave the function.
o/y The o reduction along the last dimension of Y
o/[Zjy The o reduction along the Zth dimension of Y
o/y The © reduction along the first dimension of Y
Compression and Expansion
X/Y X (logical) compressing along the last dimension of Y
X/[ ZJY X (logical) compressing along the Zth dimension of Y
X/Y X (logical) compressing along the first dimension of Y
X\Y X (logical) expanding along the last dimension of Y
X\[ Z jy X (logical) expanding along the Zth dimension of Y
X\Y X (logical) expanding along the first dimension of Y
-v Terminate execution of a suspended function.
Print the value of X. The value of any expression or variable is also printed
if no assignment is made.
A*-D Request input. Value of □ is the resulting value after expression entered is
evaluated.
Request input. Value of □ is entire input text as literal characters, up to but
not including carrier return.
'XYZ’ The literal characters XYZ.
Underline: Allows increased set of alphabetic characters, i.e., A and A are
both distinct characters.
Generalized Matrix Operations
X+ . *Y Ordinary matrix product of X and Y
Xo . o'y Generalized inner product of X and Y
X° . ©y Generalized outer product of X and Y
All scalar functions are extended to operate element-by-element on
dimensioned operands; i.e., vectors, matrixes, and higher-dimensional
arrays.
A scalar or one-component vector may be used as one argument of a
scalar dyadic function and will be extended to conform to the dimen-
sion of the other argument.
Overstruck Symbols
®wv4>í9i » ?4vCjA/\e
Mynd 2. APL táknin.
92 — TlMARIT VFÍ 1974