index =: $ #: [: I. ,

index ? 2 4$2

0 0

1 0

1 3

index ? 2 4 5$2

0 0 0

0 0 1

0 0 2

0 0 3

0 1 1

0 2 1

0 2 3

0 2 4

0 3 2

1 0 0

1 0 1

1 0 2

1 0 4

1 1 1

1 1 3

1 2 1

1 2 2

1 2 4

1 3 0

1 3 1

1 3 2


On Mon, Dec 11, 2023 at 11:06 AM LdBeth <andp...@foxmail.com> wrote:

> I've been running to too many situations that I uses  4$.$.y  a lot to
> get indexes of all non zero elements to an array, I wonder if there
> are any alternative ways to do that in J, especially when  y  is a
> boolean array.
>
> Also monadic I. only works for 1D array, while  ⍸ from APL works
> for higher dimension cases, how to implement this in J?
>
> LdBeth
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to