thanks Robert!

OK. boxes are atoms withb an empty shape.

I've looked at the docs and can't see where I could read to understand why
shape of

1 2 +/ i. 4

is 2 1 and not 1 2

thanks for your help!

Chris
On 25/09/2014 4:01 PM, "robert therriault" <bobtherria...@mac.com> wrote:

> Hi Chris,
>
> Well there is information on the vocabulary page for Table
> http://www.jsoftware.com/help/dictionary/d420.htm
>
> also Nuvoc has good information on this verb
> http://www.jsoftware.com/jwiki/Vocabulary/slash#dyadic
>
> The actual shape of a box is empty since the box is an atom. In the case
> of 1 2 +/ i. 4 the shape is actually 2 4 i.e. 2 rows of 4 not 2 1
>
>    < 1 2 +/ i. 4
> ┌───────┐
> │1 2 3 4│
> │2 3 4 5│
> └───────┘
>    $ < 1 2 +/ i. 4
>    $ each < 1 2 +/ i. 4
> ┌───┐
> │2 4│
> └───┘
>
> If you wanted the two rows to be in their own boxes then you could do
>
>    ;/  1 2 +/ i. 4
> ┌───────┬───────┐
> │1 2 3 4│2 3 4 5│
> └───────┴───────┘
>    or
>
>    <"1 [ 1 2 +/ i. 4
> ┌───────┬───────┐
> │1 2 3 4│2 3 4 5│
> └───────┴───────┘
>
>    $ <"1 [ 1 2 +/ i. 4
> 2
>
> The above shows that the shape of the two boxes is not actually 1 2
> because each box is an atom the shape is actually just 2.
>
> You are correct that an understanding of rank and shape is key to getting
> J to work for you. If you are looking for information I have always found
> Henry Rich's J for C Programmers much more accessible than the J
> dictionary.  Chapters 5 and 6 are really good at explaining rank and shape
> with regard to verbs. http://www.jsoftware.com/help/jforc/contents.htm
>
> Also, look at Nuvoc on the wiki. This is a crowd sourced resource
> organized by Ian Clark and Henry Rich which many have found useful.
> http://www.jsoftware.com/jwiki/NuVoc
>
> Enjoy the ride as you learn J. Welcome aboard.
>
> Cheers, bob
>
>
> On Sep 24, 2014, at 10:35 PM, Chris Wright <cawright...@gmail.com> wrote:
>
> > Hi
> >
> > Could I work out from the docs that
> >
> >  < 1 2 +/ i. 4
> >
> > ┌───────┐
> >
> > │1 2 3 4│
> >
> > │2 3 4 5│
> >
> > └───────┘
> >
> > will give the above (2 1) shape result
> >
> >
> > and not a (1 2) result like below?
> >
> >
> > ┌───────┬───────┐
> >
> > │1 2 3 4│2 3 4 5│
> >
> > └───────┴───────┘
> >
> >
> >
> >
> > With the (2,1) it's obvious that two 1-cells are returned,  and with
> (1,2)
> > it's not obvious (where is the boundary b/n them), but I wonder if I
> could
> > have worked out the shape of the output from the docs alone?
> >
> >
> > with thanks
> >
> >
> > Chris
> > ----------------------------------------------------------------------
> > 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

Reply via email to