Group 5
J symbol (i-dot): i.
Monadic case:
Name: integers
Rank: 1 (vector) – applies to a vector y
Definition (simple): i. y returns the first y non-negative integers. If y is negative then the order of the integers is reversed.
Definition (precise): i. y returns the first */ | y non-negative integers. That is, the number of integers returned is the product of the magnitude of the elements of the vector y. For example, */ | 2 _3 4 is 24. The shape of the result is y. If the element i of y is negative, then the order of the elements aligned along the corresponding axis i of the result is reversed.
Please also include explanations for your answers to some of the following questions:
What is the result when y is a single positive, or negative number?
What is the result when y is zero?
What is the result when y is a vector of numbers?
Dyadic case:
Name: index of
Rank: _ (left); _ (right) – applies to the entire array on the left and right side
Definition (simple): x i. y returns the first occurrence of y in x. If y does not appear in x, then the number of items in x is returned.
Definition (precise): x i. y returns the first occurrences of the sub-arrays of y in x, where the shape of the sub-arrays is defined by the shape of the items of x.
Please also include explanations for your answers to some of the following questions:
What is the index of number y in vector x?
What is the index of character y in string x?
What is the index of vector y in matrix x?
What is the result when y is not in x?
Why is the definition given in terms of the sub-arrays of y, not the items of y?