1 2 3 4  (4 16 $ [: ; ([: < 10 #. 1+perm)"0) 4  NB. my version with less 
boxing
   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

   100 timespacex '1 2 3 4  (4 16 $ [: ; ([: < 10 #. 1+perm)"0) 4'  NB. my 
version with less boxing
6.303e_5 10368

Cheers, bob

> On Jul 17, 2020, at 16:27, 'robert therriault' via Programming 
> <[email protected]> wrote:
> 
> Hey Skip,
> 
> Here is what I have come up with
> 
>   4 16$>10#.each >: each ({1 perm 4),({2 perm 4),({3 perm 4),({4 perm 4)  NB. 
> your version
>   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
> 
>   1 2 3 4  (4 16 $  [: ; ((10 #. 1+perm)each)) 4  NB. my version with boxing
>   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
> 
>   1 2 3 4  (4 16 $ 0 -.~ [: , (10 #. 1+perm)"0) 4 NB. my version without 
> boxing
>   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
> 
>   100 timespacex '4 16$>10#.each >: each ({1 perm 4),({2 perm 4),({3 perm 
> 4),({4 perm 4)'  NB. your version
> 9.887e_5 98752
>   100 timespacex '1 2 3 4  (4 16 $  [: ; ((10 #. 1+perm)each)) 4'  NB. my 
> version with boxing
> 7.861e_5 10752
>   100 timespacex '1 2 3 4  (4 16 $ 0 -.~ [: , (10 #. 1+perm)"0) 4' NB. my 
> version without boxing
> 6.582e_5 10752
> 
> Cheers,  bob
> 
> 
>> On Jul 17, 2020, at 16:07, Raul Miller <[email protected]> wrote:
>> 
>> This gets close, but runs afoul of padding rules:
>> 
>>  10#.1 2 3 4 >:@perm every 4
>> 
>> Anyways, it looks like
>> 
>>  ;1 2 3 4 <@(10 p.~ >:)@perm every 4
>> 
>> might do what you want.
>> 
>> Thanks,
>> 
>> -- 
>> Raul
>> 
>> On Fri, Jul 17, 2020 at 5:47 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

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to