Hi Skip,
Check out the Vocabulary page for {
https://code.jsoftware.com/wiki/Vocabulary/curlylf

On Mon, Dec 21, 2020 at 9:09 AM Skip Cave <[email protected]> wrote:

> ]x=.1 3 5;2;3 4
>
> ┌─────┬─┬───┐
>
> │1 3 5│2│3 4│
>
> └─────┴─┴───┘
>
> {x
>
> ┌─────┬─────┐
>
> │1 2 3│1 2 4│
>
> ├─────┼─────┤
>
> │3 2 3│3 2 4│
>
> ├─────┼─────┤
>
> │5 2 3│5 2 4│
>
> └─────┴─────┘
>
>
> Wow! I had no idea monadic { could do that to an already-boxed array! Till
> now I had always used monadic { just to box vectors, just like <
>
> {1 2 3
>
> ┌─────┐
>
> │1 2 3│
>
> └─────┘
>
> <1 2 3
>
> ┌─────┐
>
> │1 2 3│
>
> └─────┘
>
> Thanks Henry & Chris.
> Where is the doc describing that monadic { feature?
>
> ,/> is nice as well, and this I understand. It's just insert/ravel. Turns a
> 3x2x3 array into a 3x6 array.
>
> Skip Cave
>
>
>
> On Sun, Dec 20, 2020 at 12:51 PM Henry Rich <[email protected]> wrote:
>
> > ,/>{x
> >
> > Henry Rich
> >
> > On 12/20/2020 1:48 PM, Skip Cave 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
> >
> >
> > --
> > This email has been checked for viruses by AVG.
> > https://www.avg.com
> >
> > ----------------------------------------------------------------------
> > 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