The following table shows what the shapes and ranks are for the various types of
arrays:
Data
Type Shape pX Rank p pX
Scalar No dimension (indicated by a blank line). 0
Vector Number of elements. 1
Matrix Number of rows and the number of columns. 2
N-rank
arrays Each number is the length 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 creating lists (see Catenation in this chapter) or when branching in a user-
defined function (see Chapter 6).
Following are some ways to generate empty arrays:
Assign I 0 to a variable name to generate an empty vector:
%: v 14: c: 'r' C) R
4.. \ 0
I:: \I E: if 'r c1 Ii
An empty array is indicated
4
by a blank display.
6) EZ v E: (1: 'I' IS I?
0
\
The shape of the empty vector
is zero (zero elements).
0 Use a zero length coordinate when generating a multidimensional array:
This matrix has three rows
EM AT R :E X :I. +*3 0 c) 1 0- and no (0) columns.
E.. El 4 'I' li 1: x :I.
4 A blank output display
3 0
~)mmruxi.
0 A function might generate an empty vector as its result; for example, finding the
shape of a scalar:
(3 ' A '
4 A blank output display.
36
arrays:
Data
Type Shape pX Rank p pX
Scalar No dimension (indicated by a blank line). 0
Vector Number of elements. 1
Matrix Number of rows and the number of columns. 2
N-rank
arrays Each number is the length 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 creating lists (see Catenation in this chapter) or when branching in a user-
defined function (see Chapter 6).
Following are some ways to generate empty arrays:
Assign I 0 to a variable name to generate an empty vector:
%: v 14: c: 'r' C) R
4.. \ 0
I:: \I E: if 'r c1 Ii
An empty array is indicated
4
by a blank display.
6) EZ v E: (1: 'I' IS I?
0
\
The shape of the empty vector
is zero (zero elements).
0 Use a zero length coordinate when generating a multidimensional array:
This matrix has three rows
EM AT R :E X :I. +*3 0 c) 1 0- and no (0) columns.
E.. El 4 'I' li 1: x :I.
4 A blank output display
3 0
~)mmruxi.
0 A function might generate an empty vector as its result; for example, finding the
shape of a scalar:
(3 ' A '
4 A blank output display.
36