## i. y (Integers)

Returns an ascending (or descending) sequence of integers, wrapped to the shape specified by |y.

```   i. 6
0 1 2 3 4 5

i. 2 3
0 1 2
3 4 5

i. 6 1
0
1
2
3
4
5```

If an atom of y is negated, this specifies reversal along that dimension.

```   i. _6
5 4 3 2 1 0

i. 2 _3
2 1 0
5 4 3

i. _2 3
3 4 5
0 1 2

i. _2 _3
5 4 3
2 1 0```

For y all-positive, y is the shape of the matrix (i.y). Thus for any given positive integer list: shape: i.shape is equivalent to: shape \$ i. (*/shape)

```   shape=: 2 3
i. shape
0 1 2
3 4 5

shape \$ i. (*/shape)
0 1 2
3 4 5```

### Common uses

1. Make a sample numeric matrix for miscellaneous test purposes

```   ] z=: i. 3 5
0  1  2  3  4
5  6  7  8  9
10 11 12 13 14

+/ z
15 18 21 24 27

+/"1 z
10 35 60```

2. Generate the identity permutation

```   N=: 4
] i=: i.N    NB. the identity permutation on N points
0 1 2 3```

3. Make a "self-indexing" numeric matrix for investigating the behavior of a given J primitive, e.g. Transpose (|:).

• "self-indexing" here means that each cell contains (an integer representing) its own array index

```   ii=: ] {. [: i. 10 #~ #   NB. utility verb for generating a test matrix

] z=: ii 2 3 4
0   1   2   3
10  11  12  13
20  21  22  23

100 101 102 103
110 111 112 113
120 121 122 123
\$ z
2 3 4
\$ |: z
4 3 2

1 0 2 |: z
0   1   2   3
100 101 102 103

10  11  12  13
110 111 112 113

20  21  22  23
120 121 122 123```

## x i. y (Index Of)

Finds the first occurrence of item y in list x

```   'abracadabra' i. 'a'
0
'abracadabra' i. 'acd'   NB. several search terms at once
0 4 6```

Note: to find all occurrences, use Equal (=) together with Indices (I.).

```   I. 'abracadabra' = 'a'
0 3 5 7 10```

If list x doesn't contain y, then the index returned is 1+#x (which would yield index error).

```   'abcdef' i. 'k'
6
6 { 'abcdef'
|index error
|   6    {'abcdef'```

Verb i. can also be used with a matrix x (a list of lists). Then the entire row of x must be matched for a valid index to be returned.

• WARNING: anything else will show as 1+#x without signalling an error, so be sure to get your search term y in the right form!

```   ] y=: > 'alpha' ; 'bravo' ; 'charlie'
alpha
bravo
charlie
y i. 'charlie'
2