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