OK = Oleg, DB = me
DB> Whoops, other way around:
DB>
DB> 1 j. <: #;.1~ 1 0 0 0 1 0 1
DB> 1j3 1j1 1
OK> And how about this?
OK>
OK> 0 1 1 0 0 1 #^:_1!.'.' 'abc'
OK> .ab..c
Dyad # provides only for fills that follow items, and only for x and y
which agree in length. Therefore, there is no
(complex)&# equivalent to (0 , boolean)&(#^:_1) .
None the less, it can be simulated:
db =. 1 j. <: #;.1~ b=. 0 1 1 0 0 1
_1 |. ('abc' {.~ #x) #!.'.'~ x =. db , 0 j. b i. 1
.ab..c
As a verb:
expand =: _1 |. ] (] #!.'.' ({.~ #) ) (0 j. [ i. 1:) ,~ 1 j. _1 +
#;.1~@:[
b expand 'abc'
.ab..c
(Obviously, if you want this result from these arguments, you should use #^:_1
.)
Perhaps dyad # can be extended such that a negative imaginary component a j.
-b would mean a items /preceded/ by |b fills.
I've wanted that a couple times in my J career (actually, once recently).
-Dan
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm