Yes. Thanks. That is what I want, exactly. I just need a little time to digest 
what you've done. I'm not sure why arr is being boxed. Presumably under (&.) 
wants a boxed argument. 
I'm also not sure why your implicit loop, 2 4{."1 , works while mine didn't.
Is there somewhere in the dictionary/NuVoc that explains this?
I am aware that f&.> is often used to unbox an argument, apply f to the result 
and then box it again. But am not sure how that applies to my problem.


> Date: Fri, 26 Sep 2014 12:51:03 -0400
> From: [email protected]
> To: [email protected]
> Subject: Re: [Jprogramming] Length errors when getting multiple columns from  
> array
> 
> Not entirely sure what you want, but is this it?
> 
>    3 4{."1&.><arr
> +-----+-------+
> |0 1 2|0 1 2 3|
> |6 7 8|6 7 8 9|
> |2 3 4|2 3 4 5|
> |8 9 0|8 9 0 1|
> |4 5 6|4 5 6 7|
> |0 1 2|0 1 2 3|
> |6 7 8|6 7 8 9|
> |2 3 4|2 3 4 5|
> |8 9 0|8 9 0 1|
> |4 5 6|4 5 6 7|
> +-----+-------+
> 
> 
> On Fri, Sep 26, 2014 at 12:44 PM, Jon Hough <[email protected]> wrote:
> 
> > I have a 2-d array. e.g.
> > arr =: 10 6 $ i. 10
> > I want to get the first 3 columns from the array, e.g.  3{."1and get the
> > first 4 elements, e.g. 4{."1
> > However, combining these, as in
> > 3 4 {."(0 1) arrgives a length error. Of course 3{. and 4{.  will give
> > different shape results so should be boxed and then concatenated
> > perhaps(?). I am not sure how to do this, but the end result I want would
> > be something like:
> >
> > ┌─────┐
> >
> > │0 1 2│
> >
> > │6 7 8│
> >
> > │2 3 4│
> >
> > │8 9 0│
> >
> > │4 5 6│
> >
> > │0 1 2│
> >
> > │6 7 8│
> >
> > │2 3 4│
> >
> > │8 9 0│
> >
> > │4 5 6│
> >
> > └─────┘
> >
> >
> > concatenated with
> >
> >
> > ┌───────┐│0 1 2 3││6 7 8 9││2 3 4 5││8 9 0 1││4 5 6 7││0 1 2 3││6 7 8 9││2
> > 3 4 5││8 9 0 1││4 5 6 7│
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > └───────┘
> >
> >
> >
> > ----------------------------------------------------------------------
> > For information about J forums see http://www.jsoftware.com/forums.htm
> 
> 
> 
> 
> -- 
> Devon McCormick, CFA
> ----------------------------------------------------------------------
> 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