Building on Boss's and Miller's answer, I get the
following. Two ,/,/ 's work for M , but not for M, 1 0 0 0
for example; in that case three ,/,/,/ 's are required. TBA
expndZrs =: _1 1 (] i.&0)}"0 1 ]
expndZrs1 =: ]`expndZrs`($:@expndZrs)@.(2<.+/@( e.&0))"1
(-. 1{.0#]),/,/expndZrs1 M
1 _1 _1 1
1 _1 1 1
1 1 _1 1
_1 1 _1 _1
_1 1 1 _1
1 1 _1 _1
1 1 1 _1
On Tue, 4 Mar 2008, Raul Miller wrote:
I have some comments in addition to R.E.Boss's comments
(and using his M)
M=:1 _1 0 1,1 1 _1 1,:0 1 0 _1
A simple approach to supressing fill uses box (<) followed
by raze (;). In other words:
<@(_1 1 (] i.&0)}"0 1 ])`<@.(# = i.&0)"1 M
+---------+--------+---------+
|1 _1 _1 1|1 1 _1 1|_1 1 0 _1|
|1 _1 1 1| | 1 1 0 _1|
+---------+--------+---------+
;<@(_1 1 (] i.&0)}"0 1 ])`<@.(# = i.&0)"1 M
1 _1 _1 1
1 _1 1 1
1 1 _1 1
_1 1 0 _1
1 1 0 _1
However, J currently does does not have special
code for this pattern, so you might instead delete
your fills (caution: I have not actually tested this
so this might be either slower or faster):
,/(_1 1 (] i.&0)}"0 1 ])[EMAIL PROTECTED](# = i.&0)"1 M
1 _1 _1 1
1 _1 1 1
1 1 _1 1
0 0 0 0
_1 1 0 _1
1 1 0 _1
(-. 1{.0#]),/(_1 1 (] i.&0)}"0 1 ])[EMAIL PROTECTED](# = i.&0)"1 M
1 _1 _1 1
1 _1 1 1
1 1 _1 1
_1 1 0 _1
1 1 0 _1
You have some other possibilities, too. For example:
;((+ <@:~.@:,: -)"1 =&0)M
(B=) <----------my "sig"
Brian Schott
Atlanta, GA, USA
schott DOT bee are eye eh en AT gee em ae eye el DOT com
http://schott.selfip.net/~brian/
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm