Ken Chakahwata wrote: > I am looking at the various expressions contributed to date > to see which ones are general enough to handle a character > vector right argument.
My original, longish, verb can be easily generalized:
diag0 =: =@/:`(_2{.#,:@#,:)}
diag0 1 2 3 4
1 0 0 0
0 2 0 0
0 0 3 0
0 0 0 4
diag0 'abcd'
a
b
c
d
-Dan
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
