I think >,{x would do the right thing.

Thanks,

-- 
Raul

On Fri, Dec 25, 2020 at 1:27 PM Devon McCormick <[email protected]> wrote:
>
> > Henry's proposal doesn't work for larger list
> >   $,/>{x
> > 12 5 3 5 4 4 8
> which looks like it does work since 14400 = */12 5 3 5 4 4 .  It's the same
> number of items.
>
> On Sun, Dec 20, 2020 at 5:42 PM Skip Cave <[email protected]> wrote:
>
> > Trying larger lists:
> >
> > ]x=.31 16 45;3 19 16 4;30 14 46 14 20;34; 41 39 23;30 9 36 9 32; 46 20 30
> > 44;44 35 49 23
> >
> >
> > │31 16 45│3 19 16 4│30 14 46 14 20│34│41 39 23│30 9 36 9 32│46 20 30 44│44
> > 35 49 23│
> >
> >
> > Henry's proposal doesn't work for larger list
> >
> > $,/>{x
> >
> > 12 5 3 5 4 4 8
> >
> >
> > But Chris' does:
> >
> > $>,{x
> >
> > 14400 8
> >
> >
> > Skip Cave
> >
> >
> >
> > On Sun, Dec 20, 2020 at 12:48 PM Skip Cave <[email protected]>
> > wrote:
> >
> > > I have three lists stored in x:
> > >
> > > ]x=.1 3 5;2;3 4
> > >
> > > ┌─────┬─┬───┐
> > >
> > > │1 3 5│2│3 4│
> > >
> > > └─────┴─┴───┘
> > >
> > > I want to find all possible combinations of the elements of these lists
> > > (taking one from each list).
> > >
> > > Using the odometer function I can generate all the possible index
> > > combinations of selections from those three lists:
> > >
> > >
> > > odo ;# each x
> > >
> > > 0 0 0
> > >
> > > 0 0 1
> > >
> > > 1 0 0
> > >
> > > 1 0 1
> > >
> > > 2 0 0
> > >
> > > 2 0 1
> > >
> > >
> > > Now I can individually find each selection from the three lists
> > >
> > >
> > > ;0 0 0{ea { >x
> > >
> > > 1 2 3
> > >
> > > ;0 0 1{ea { >x
> > >
> > > 1 2 4
> > >
> > > ;1 0 0{ea { >x
> > >
> > > 3 2 3
> > >
> > > ;1 0 1{ea { >x
> > >
> > > 3 2 4
> > >
> > > ;2 0 0{ea { >x
> > >
> > > 5 2 3
> > >
> > > ;2 0 1{ea { >x
> > >
> > > 5 2 4
> > >
> > >
> > > How can I generate all of the selections in one 6x3 matrix using just one
> > > statement, with no explicit looping?
> > >
> > >
> > > Skip
> > >
> > > Skip Cave
> > >
> > >
> > ----------------------------------------------------------------------
> > For information about J forums see http://www.jsoftware.com/forums.htm
> >
>
>
> --
>
> Devon McCormick, CFA
>
> Quantitative Consultant
> ----------------------------------------------------------------------
> 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