Dan Bron wrote:
>     (,&.>c) ([: +/ =/)&> <i.#b

where
   a =: ;: 'he ha ho he hi he'
   b =: ~. a
   c=: 1 3 3; 2; 0; 0

A compact variation on this theme is
   +/"2>c=/L:0 i.#b
0 1 0 2
0 0 1 0
1 0 0 0
1 0 0 0
 
-- 
Raul
 
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to