If I have a list of indices with possible repetitions, such as

   i=: 1 3 1

how do I convert it to a mask m so that n{m is the number of
occurrences of n in i ?

   m=: +/ i =/ i. >: >./ i
0 2 0 1

I can convert from the mask to the (sorted) list of indices with the
I. builtin, eg.

   I. m
1 1 3

but is there a simpler way for the conversion to mask?  Would it make
sense if I.^:_1 did this?

Ambrus
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to