If that is the case, you could use
3 5 5 $ 5 # i.5
0 0 0 0 0
1 1 1 1 1
2 2 2 2 2
3 3 3 3 3
4 4 4 4 4
0 0 0 0 0
1 1 1 1 1
2 2 2 2 2
3 3 3 3 3
4 4 4 4 4
0 0 0 0 0
1 1 1 1 1
2 2 2 2 2
3 3 3 3 3
4 4 4 4 4
or
3 5 5 ($ ] # i.)5
0 0 0 0 0
1 1 1 1 1
2 2 2 2 2
3 3 3 3 3
4 4 4 4 4
0 0 0 0 0
1 1 1 1 1
2 2 2 2 2
3 3 3 3 3
4 4 4 4 4
0 0 0 0 0
1 1 1 1 1
2 2 2 2 2
3 3 3 3 3
4 4 4 4 4
or even
($ (# i.)@{:)3 5 5
0 0 0 0 0
1 1 1 1 1
2 2 2 2 2
3 3 3 3 3
4 4 4 4 4
0 0 0 0 0
1 1 1 1 1
2 2 2 2 2
3 3 3 3 3
4 4 4 4 4
0 0 0 0 0
1 1 1 1 1
2 2 2 2 2
3 3 3 3 3
4 4 4 4 4
Cheers, bob
> On Jun 8, 2016, at 12:33 PM, Marshall Lochbaum <[email protected]> wrote:
>
> I'm assuming there are a lot of missing newlines in your sample output,
> and it should actually be a shape 3 5 5 array. Here's a solution which
> uses rank many times:
>
> (3 5 5$0) ]"0"1 0"2 1 i.5
> 0 0 0 0 0
> 1 1 1 1 1
> 2 2 2 2 2
> 3 3 3 3 3
> 4 4 4 4 4
>
> 0 0 0 0 0
> 1 1 1 1 1
> 2 2 2 2 2
> 3 3 3 3 3
> 4 4 4 4 4
>
> 0 0 0 0 0
> 1 1 1 1 1
> 2 2 2 2 2
> 3 3 3 3 3
> 4 4 4 4 4
>
> It's probably better practice to use negative rank, even though the
> numbers are harder to read:
>
> (3 5 5$0) ]"_1 _"_1"_1 _ i.5
>
> This makes it clear that we are mapping over just the left argument,
> then over both arguments, then over just the left argument again.
>
> Marshall
>
> On Wed, Jun 08, 2016 at 09:22:43AM +0000, 'Bo Jacoby' via Programming wrote:
>> Dear J'ers.
>> Please tell me how to program the 3 5 5 array below.
>> I am experimenting rather than understanding. I expect the answer to be
>> quite elementary.
>> Thanks! Bo.
>>
>> 0 0 0 0 01 1 1 1 12 2 2 2 23 3 3 3 34 4 4 4 4
>> 0 0 0 0 01 1 1 1 12 2 2 2 23 3 3 3 34 4 4 4 4
>> 0 0 0 0 01 1 1 1 12 2 2 2 23 3 3 3 34 4 4 4 4
>>
>> ----------------------------------------------------------------------
>> 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