Group 1

 

J symbol (dollar):  $

 

Monadic case:

 

Name: shape

Rank: _ (infinite/unbounded) – applies to the entire array y

Definition (simple): $ y is the shape of y (i.e., a list of the lengths of each axis of y).

Definition (precise): $ y returns a numeric list, where the ith element of the list is the length of the ith axis of y, or if y is a scalar then $ y is an empty list (scalars have no axes).

 

Please also include explanations for your answers to some of the following questions:

What is the shape of a scalar, vector, matrix, rank 3 array?

What is the shape of an empty list?

How do you find the rank of a scalar, vector, matrix, r-array using $ ?

 

 

 

 

 

Dyadic case:

 

Name: reshape

Rank: 1 (left); _ (right) – applies to a vector on the left and the entire array on the right

Definition (simple): x $ y reshapes array y into the shape specified by x.

Definition (precise): x $ y the shape of x $ y is x, siy where siy is the shape of an item of y; x $ y gives a length error if y is empty and x, siy does not contain a zero.

 

Please also include explanations for your answers to some of the following questions:

Reshape a scalar, vector, matrix?

What happens when (an element of)  x is 0?

What happens when x is empty?

What happens when y contains too many elements?

What happends when y contains too few elements?