f=. 13 : 0
 ('';,.x),.(y);x +/ y
)
   f
('' ; [: ,. [) ,. ] ; +/

2011/11/20 Kip Murray <[email protected]>

> Now make this into a tacit verb table so that a table b gives you the
> table.
>
> On 11/20/2011 7:09 AM, Björn Helgason wrote:
> > or
> >
> > ('';,.a),.(b);a +/ b
> >
> > 2011/11/20 Björn Helgason<[email protected]>
> >
> >>
> >> 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
>



-- 
Björn Helgason, Verkfræðingur
Fornustekkum II
781 Hornafirði,
t-póst: [email protected]
gsm: +3546985532
twitter: @flugfiskur
http://groups.google.com/group/J-Programming


Tæknikunnátta höndlar hið flókna, sköpunargáfa er meistari einfaldleikans

góður kennari getur stigið á tær án þess að glansinn fari af skónum
          /|_      .-----------------------------------.
         ,'  .\  /  | Með léttri lund verður        |
     ,--'    _,'   | Dagurinn í dag                     |
    /       /       | Enn betri en gærdagurinn  |
   (   -.  |        `-----------------------------------'
   |     ) |         (\_ _/)
  (`-.  '--.)       (='.'=)   ♖♘♗♕♔♙
   `. )----'        (")_(") ☃☠
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to