Not an exper, moi, but a look at NuVoc suggests:
1 0 0 0 1 0 0 1 0 1 <;.1"1 r
+-------+-----+---+-+
|9 8 6 1|2 2 2|6 8|7|
+-------+-----+---+-+
|5 4 8 4|2 7 9|1 4|1|
+-------+-----+---+-+
|4 3 3 7|7 0 6|7 6|6|
+-------+-----+---+-+
Using just the sizes of the elements m suggests this for par :
par =: ;@:((1 {.~ #)&.>)@:[ <;.1"1 ]
and then:
m par r
+-------+-----+---+-+
|9 8 6 1|2 2 2|6 8|7|
+-------+-----+---+-+
|5 4 8 4|2 7 9|1 4|1|
+-------+-----+---+-+
|4 3 3 7|7 0 6|7 6|6|
+-------+-----+---+-+
Please note this works just as well:
(;:'abcd efg ij k') par r
So you might as well just use:
4 3 2 1 (;@:((1 {.~ [)&.>)@:[ <;.1"1 ])r
+-------+-----+---+-+
|9 8 6 1|2 2 2|6 8|7|
+-------+-----+---+-+
|5 4 8 4|2 7 9|1 4|1|
+-------+-----+---+-+
|4 3 3 7|7 0 6|7 6|6|
+-------+-----+---+-+
Just a first shot - the experts will have something far superior to offer!
Mike
On 07/04/2020 18:32, Skip Cave wrote:
Given an array of random integers:
r
9 8 6 1 2 2 2 6 8 7
5 4 8 4 2 7 9 1 4 1
4 3 3 7 7 0 6 7 6 6
And a partitioning template:
]m=.0 1 2 3;4 5 6;7 8;9
┌───────┬─────┬───┬─┐
│0 1 2 3│4 5 6│7 8│9│
└───────┴─────┴───┴─┘
How to produce the following partitions of r?
m par r
┌───────┬─────┬───┬─┐
│9 8 6 1│2 2 2│6 8│7│
├───────┼─────┼───┼─┤
│5 4 8 4│2 7 9│1 4│1│
├───────┼─────┼───┼─┤
│4 3 3 7│7 0 6│7 6│6│
└───────┴─────┴───┴─┘
How do you define the dyadic par verb in m par r?
Skip Cave
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
--
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm