Or to get all of columns 4 and 1, you would enter:
42
Note: You still have to enter the semicolon to make clear which coordinate is which.
The number of semicolons required is the rank of the array minus one. If the correct
number of semicolons is not specified, RANK ERROR results:
You can change elements within an array by assigning new values for the indexed
elements. (The rest of the array remains unchanged.)
Chapter 4. Primitive (Built-In) Functions
Argument A
Scalar
APL functions are of two types: user-defined and those that are built into the APL
language. User-defined functions are discussed in Chapter 6. Built-in functions,
called primitive functions, are denoted by a symbol and operate on the data you
supply to them.
Argument B
Scalar
The value or values you supply are called arguments. Primitive functions that use
two arguments, such as A f B, are said to be dyadic; functions that use one argument
are said to be monadic, such as + 6, which yields the reciprocal of 6. Arguments can
be single data items (scalars), strings of data (vectors), tables of data (matrices), or
multiple tables of data (N-rank arrays). Arguments can also be expressions or user-
defined functions that result in a scalar, vector, matrix, or N-rank array.
Array of
any shape
One-element
array
There are two types of primitive functions: scalar functions and mixed functions.
There are also operators that operate on the primitive functions. Examples of the
functions and operators are provided throughout this chapter for easy reference and
are set up as they would appear on the display.
Scalar or one-
element array
One-element array
with the rank
different from the
rank of A
PRIMITIVE SCALAR FUNCTIONS
Scalar functions operate on scalar arguments and arrays. They are extended to
arrays element by element. The shape and rank (see Chapter 3) of the result de-
pend on the shape and rank of the arguments. For dyadic scalar functions, the re-
lation between the types of arguments and the shape of the result is shown in the
following table. Each scalar function is described following the table:
Array
I
Array with the same
shape as A
Scalar or one-
element array shape
Array of any
Result
Scalar
Array with the same
shape as the
arguments
Array with the
same shape as
argument B
Array with the same
shape as argument A
One-element array
with the shape of
the array with the
greater rank
43
Previous Page Next Page