Where R←⍸Y

Classic Edition: the symbol (Iota Underbar) is not available in Classic Edition, and Where is instead represented by ⎕U2378.

Y must be a simple Boolean or numeric array of non-negative integers.

The model for Where can be expressed as {(,⍵)/,⍳⍴⍵}.

If Y is Boolean, R is a vector of the indices of all the 1s in Y. If Y is all zeros, R is an empty vector.

⎕IO is an implicit argument of Where.

Examples

      ⎕IO
1
       1 0 1 0 0 0 0 1 0
1 3 8

      'e'='Pete'
2 4

      3 40 1 1
0 1 1 0
1 1 0 1
1 0 1 1

       3 40 1 1
┌───┬───┬───┬───┬───┬───┬───┬───┐
1 21 32 12 22 43 13 33 4
└───┴───┴───┴───┴───┴───┴───┴───┘

      2 3 40 0 0 0 1
┌─────┬─────┬─────┬─────┐
1 2 11 3 22 1 32 2 4
└─────┴─────┴─────┴─────┘

       0 1 0 2
2 4 4

      {/⍥,⍳⍴} 0 1 0 2
2 4 4
      2 20 1 2 3
┌───┬───┬───┬───┬───┬───┐
1 22 12 12 22 22 2
└───┴───┴───┴───┴───┴───┘