bill lam wrote:
A related question, how to transform it into index to the firststone of the
group, assuming at least a '1' exist,
eg. from this boolean array
  0 1 0 1 0 0 1 0 0 0 1 0
I want the array
  0 1 1 3 3 3 6 6 6 6 10 10

I can do it but not elegant.

   a=. 0 1 0 1 0 0 1 0 0 0 1 0

   >./\(* i.&#) a
0 1 1 3 3 3 6 6 6 6 10 10

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

Reply via email to