Randy A MacDonald wrote:
> Good, but I'm not sure what's going on in this case:
> (1 j. #;._1)0 1 0 0 0 1 0 1
> 1j1 1 1 1j1 1j1
(<;._1) 1 0 0 0 1 0 1
+-----+-++
|0 0 0|0||
+-----+-++
In other words, (#;._1) 1 0 0 0 1 0 1 counts the zeros
which follow each one.
(<;._1) 0 1 0 0 0 1 0 1
+-+++-+-+
|1|||1|1|
+-+++-+-+
In other words, (#;._1) 1 0 0 0 1 0 1 counts the ones
which follow each zero.
Unfortunately, I'm not sure how to come up with an
"expand value for #" which deals with the leading
zeros case for #^:_1. (And, I don't know how to
construct a good verb which generated that value.)
0 1 1 #^:_1 'ab'
ab
0j1 1 1# 'ab'
|length error
FYI,
--
Raul
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm