>,{1 3 5;2;3 4
1 2 3
1 2 4
3 2 3
3 2 4
5 2 3
5 2 4

On Sun, Dec 20, 2020 at 10:48 AM 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
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to