Empty Arrays - IBM 5110 User Manual

Apl
Table of Contents

Advertisement

The following table shows what the shapes and ranks are for the
various types of arrays:
Data
Type
Shape
pX
Rank
ppX
Scalar
No dimension (indicated
by an empty vector).
0
Vector
Number of elements.
1
Matrix
Number of rows and the
number of columns.
2
N-rank
Each number is the length
arrays
of a coordinate.
N
Empty Arrays
Although most arrays have one or more elements, arrays with no
elements also exist. An array with no elements is called an empty
array. Empty arrays are useful when you are creating lists (see
Catenation in this chapter) or branching in a user-defined function.
Following are some ways to generate empty arrays:
• Assign
10
to a variable name to generate an empty vector:
EVECTOR'·· \ 0
[VECTDR
1--------------------------------------------------
An empty array is indicated
~)EVECTDI~
by a blank display.
()
,~-----------------------
The shape of the empty vector
is zero (zero elements).
• Use a zero length coordinate when generating a multidimensional
array:
This matrix has three rows and no (0)
EMArl~IXl ~-<'5
()
p \ () ... _ _
columns. If one of the coordinates is
EMATf{IXl
not zero, you cannot generate the
empty array.
" " A Blank Output Display
pEMATI~IXl
• A function might generate an empty vector as its result; for
example, finding the shape of a scalar:
p'A'
_------------------------ A Blan k Output displ ay.
APL Language Elements
21

Advertisement

Table of Contents
loading

Table of Contents