I appreciate your effort demonstrate on how to derive reusable code in J. It is important to know how to adapt existed solutions for different needs.
To me knowing that I can use the shape of the array to decode (#:) indices generated by I. is a good enough respond to my question. So I also thank to everyone who presented their answer. LdBeth >>>>> In <nloqlak--...@tutamail.com> >>>>> "'Viktor Grigorov' via Programming" <programm...@jsoftware.com> wrote: Viktor> A fully tacit solution would encapsulate the predicate too, Viktor> here parenthesized for emphasis: Viktor> ($ #: [: I. [: (5&=) ,) (>:i.8)* 8 8 $ 1j2 # 1 Viktor> 4 1 Viktor> 4 4 Viktor> 4 7 ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm