Raul,  Perfect!

4 16$1 2 3 4 mulperm 2 3 4 5

2 3 4 5 32 23 42 24 52 25 43 34 53 35 54 45

432 342 423 243 324 234 532 352 523 253 325 235 542 452 524 254

425 245 543 453 534 354 435 345 5432 4532 5342 3542 4352 3452 5423 4523

5243 2543 4253 2453 5324 3524 5234 2534 3254 2354 4325 3425 4235 2435 3245
2345

Or sorted:

4 16$/:~1 2 3 4 mulperm 2 3 4 5

2 3 4 5 23 24 25 32 34 35 42 43 45 52 53 54

234 235 243 245 253 254 324 325 342 345 352 354 423 425 432 435

452 453 523 524 532 534 542 543 2345 2354 2435 2453 2534 2543 3245 3254

3425 3452 3524 3542 4235 4253 4325 4352 4523 4532 5234 5243 5324 5342 5423
5432


Thanks!


Skip Cave
Cave Consulting LLC


On Fri, Jul 17, 2020 at 11:26 PM Raul Miller <[email protected]> wrote:

> Is this what you are after (the order is slightly different)?
>
>    mulperm=: [: ; (perm&.> #) (10 p.~ {)L:0 ]
>    1 2 3 mulperm 2 4 5
> 2 4 5 42 24 52 25 54 45 542 452 524 254 425 245
>    1 3 mulperm 2 4 5
> 2 4 5 542 452 524 254 425 245
>
> Thanks,
>
> --
> Raul
>
> On Fri, Jul 17, 2020 at 11:35 PM Skip Cave <[email protected]>
> wrote:
> >
> > Thanks Raul & Bob for the excellent & concise solutions to my problem.
> > I would like to generalise the verb a bit more to a dyadic verb where the
> > lengths of the multiple permutations
> > and the permuted items are the x & y of the dyad are adjustable:
> >
> > 1 2 3  mulperm 2 4 5
> >
> > 2 4 5 24 25 42 45 52 54 245 254 425 452 524 542
> >
> >
> > 1 3  mulperm 2 4 5 2 4 5 245 254 425 452 524 542
> >
> >
> > Here's as far as I have gotten:
> >
> > >10#.ea~.(1{.ea n),(2{.ea n),n=.{(]{~[:perm #) 2 4 5
> >
> > 2 4 5 24 25 42 45 52 54 245 254 425 452 524 542
> >
> >
> > Skip Cave
> > Cave Consulting LLC
> >
> >
> > On Fri, Jul 17, 2020 at 4:46 PM Skip Cave <[email protected]>
> wrote:
> >
> > > Is there a more efficient and/or concise way to generate this sequence?
> > >
> > > 4 16$>10#.each >: each ({1 perm 4),({2 perm 4),({3 perm 4),({4 perm 4)
> > >
> > > 1 2 3 4 12 21 13 31 14 41 23 32 24 42 34 43
> > >
> > > 123 132 213 231 312 321 124 142 214 241 412 421 134 143 314 341
> > >
> > > 413 431 234 243 324 342 423 432 1234 1243 1324 1342 1423 1432 2134 2143
> > >
> > > 2314 2341 2413 2431 3124 3142 3214 3241 3412 3421 4123 4132 4213 4231
> 4312
> > > 4321
> > >
> > >
> > > Something like :
> > >
> > > 1 2 3 4 each perm 4 NB. I know this doesn't work :-)
> > >
> > > Or:
> > >
> > > 1 2 3 4 {."1 each perm 4 NB. This doesn't work either :-)
> > >
> > > Skip Cave
> > > Cave Consulting LLC
> > >
> > ----------------------------------------------------------------------
> > 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