Ok it is simple j we are after
We start by defining a and b

     a=: 2 3 5
     b=: 0 1 2 3

Then we create the elements we want

   '';b;a;a +/ b
┌┬───────┬─────┬───────┐
││0 1 2 3│2 3 5│2 3 4 5│
││       │     │3 4 5 6│
││       │     │5 6 7 8│
└┴───────┴─────┴───────┘

Now we rearrange a so it goes down in a column

   '';b;(,.a);a +/ b
┌┬───────┬─┬───────┐
││0 1 2 3│2│2 3 4 5│
││       │3│3 4 5 6│
││       │5│5 6 7 8│
└┴───────┴─┴───────┘

Next we arrange it in a 2 by 2

   ('';b),.(,.a);a +/ b
┌───────┬───────┐
│       │2      │
│       │3      │
│       │5      │
├───────┼───────┤
│0 1 2 3│2 3 4 5│
│       │3 4 5 6│
│       │5 6 7 8│
└───────┴───────┘

ooppss wrong wa around we fix it with transpose


   |:('';b),.(,.a);a +/ b
┌─┬───────┐
│ │0 1 2 3│
├─┼───────┤
│2│2 3 4 5│
│3│3 4 5 6│
│5│5 6 7 8│
└─┴───────┘
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to