Raul -
Following this thread, I managed to grasp (reproduce) the expression
(0 2 1 |: 3 5 5 $ i. 5) which Bo found satisfactory.
Challenged by your remark "But probably no easier to read." I have
tried to sort of reconstruct your approach:
First I read up on dyadic Antibase (x #: y) and found the remainder
example; thus
> ,(i. 10) ;(5 #: i. 10)
0 1 2 3 4 5 6 7 8 9
0 1 2 3 4 0 1 2 3 4
Producing this square matrix
i. 5 5
0 1 2 3 4
5 6 7 8 9
10 11 12 13 14
15 16 17 18 19
20 21 22 23 24
and applying the above I got
5 #: i. 5 5
0 1 2 3 4
0 1 2 3 4
0 1 2 3 4
0 1 2 3 4
0 1 2 3 4
and (5 #: i. 3 5 5) got me three blocks of those.
Changing the axis preference (?) switched rows and columns
1 0 |: 5 #: i. 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
and in the case of the three blocks this would be written as (0 2 1
|: 5 #: i. 3 5 5) as the number of blocks remains untouched.
What seemed to me a shortcut for the special case of a
three-dimensinal arrangement of square matrices this gives the same result:
1 |: 5 #: 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
Using brackets I could write that as
(1 |: 5 #: i.) 3 5 5
replacing the (5) by grabbing it from the list like (1 { 3 5 5)
I continued to
(1 |: 1 & { #: i.) 3 5 5
which looked promising.
It looked to me as you were taking advantage of the (1) being
mentioned there twice and therefore combining, but ...
Q: Could you enlighten me on this final step..?
Thanks
-M
At 2016-06-10 06:51, you wrote:
I just stumbled across this. It occurs to me that (1&{@#:i.)3 5 5
would be one character shorter. But probably no easier to read.
Thanks, -- Raul On Wed, Jun 8, 2016 at 5:31 PM, 'Bo Jacoby' via
Programming <[email protected]> wrote: > Thanks everyone! >
This: > 0 2 1|:3 5 5$i.5 > > produces what I wanted. > The result
is however destroyed in the process of emailing it
to [email protected] . Line feeds are deleted. I
don't know why. > Problem is solved. Thanks again. >
Bo. > > Den 21:10 onsdag den 8. juni 2016 skrev Cliff Reiter
<[email protected]>: > > > > Or > ,./": 3 5$"1 0 i.5 > > 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 > > But a strange thing to want to build. > > On 6/8/2016 1:37
PM, robert therriault wrote: >> Maybe this? >> >> 5( 3
# ,:@,@":@:(#/"0)) i. 5 >> 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 >> >> But I am confused as well
about the request for a shape 3 5 5 of what appears as a shape 3 45
literal matrix. I do have '01' in mine though. :-) >> >> Cheers,
bob >> >>> On Jun 8, 2016, at 10:29 AM, Raul Miller
<[email protected]> wrote: >>> >>> Did you mean something like
this? >>> >>> (<.0.8*1+i.25) 10&#./."1] 3#,:5# i.5 >>> 0 0 0 0 1
1 1 1 12 2 2 2 23 3 3 3 34 4 4 4 4 >>> 0 0 0 0 1 1 1 1 12 2 2 2 23 3
3 3 34 4 4 4 4 >>> 0 0 0 0 1 1 1 1 12 2 2 2 23 3 3 3 34 4 4 4
4 >>> >>> Except, that doesn't get you those leading zeros for the
'01' column, >>> so maybe instead it needs to be character? >>> >>>
But a character array would not have anything to do with that 3 5
5 >>> shape you suggested, so for that, and guessing what you want,
maybe it >>> should be something like this? >>> >>> <.25%~i.3 5
5 >>> 0 0 0 0 0 >>> 0 0 0 0 0 >>> 0 0 0 0 0 >>> 0 0 0 0 0 >>> 0 0 0
0 0 >>> >>> 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 >>> >>> 2 2 2 2 2 >>> 2 2 2 2 2 >>> 2 2 2 2 2 >>> 2 2 2 2
2 >>> 2 2 2 2 2 >>> >>> Except that that doesn't look at all like
what you asked for. A 5 3 4 >>> shape gets a little
closer: >>> >>> <.12%~i.5 3 4 >>> 0 0 0 0 >>> 0 0 0 0 >>> 0 0 0
0 >>> >>> 1 1 1 1 >>> 1 1 1 1 >>> 1 1 1 1 >>> >>> 2 2 2 2 >>> 2 2 2
2 >>> 2 2 2 2 >>> >>> 3 3 3 3 >>> 3 3 3 3 >>> 3 3 3 3 >>> >>> 4 4 4
4 >>> 4 4 4 4 >>> 4 4 4 4 >>> >>> But all of these have conflicts
with some aspect of your original >>> request, and I can't figure
out what it is that you really wanted. >>> >>> I hope this
helps? >>> >>> Thanks, >>> >>> -- >>> Raul >>> >>> >>> On Wed, Jun
8, 2016 at 5:22 AM, 'Bo Jacoby' via Programming >>>
<[email protected]> 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 > >
----------------------------------------------------------------------
> 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
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm