Second draft is a little cleaner since rank 1 reverse is not required as the
matrix is still boolean at this point.
t=: (>:@i.@# * (|.+.])@:=){' ',]
t 'ab'
aa
bb
t 'abcde'
a a
b b
c
d d
e e
Cheers, bob
On 2012-12-09, at 8:01 PM, bob therriault wrote:
> First draft looks like this.
>
> (((>.|."1)@(*=)@:>:@i.@#){ ' ',])'abcde'
> a a
> b b
> c
> d d
> e e
> (((>.|."1)@(*=)@:>:@i.@#){ ' ',])'ab'
> aa
> bb
>
> One of the things that I like about J is the way it lets you build and test
> your ideas as you go. I look forward to more elegant solutions.
>
> Cheers, bob
>
> On 2012-12-09, at 6:42 PM, km wrote:
>
>> Write verb cross.
>>
>> cross 'abcde'
>> a a
>> b b
>> c
>> d d
>> e e
>>
>> (Result should look like a cross with 'abcde' along both diagonals.)
>>
>> cross 'a'
>> a
>> cross 'ab'
>> aa
>> bb
>>
>> Kip Murray
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm