It took me a while, but here is an explicit version of your solution:
sper=:>@(#~(-: ~.)@>)@,@{@($ <@i.)
sper2=: 13 :'>((-: ~.)@>,{x$<i.y)#,{x$<i.y'
(4 sper 7)-:4 sper2 7
1
Linda
-----Original Message-----
From: Programming [mailto:[email protected]] On Behalf
Of robert therriault
Sent: Monday, November 20, 2017 3:23 AM
To: [email protected]
Subject: Re: [Jprogramming] Subset Permutations
A really quick hack at the problem gave me this
sper=:>@(#~(-: ~.)@>)@,@{@($ <@i.)
3 sper 4
0 1 2
0 1 3
0 2 1
0 2 3
0 3 1
0 3 2
1 0 2
1 0 3
1 2 0
1 2 3
1 3 0
1 3 2
2 0 1
2 0 3
2 1 0
2 1 3
2 3 0
2 3 1
3 0 1
3 0 2
3 1 0
3 1 2
3 2 0
3 2 1
2 sper 4
0 1
0 2
0 3
1 0
1 2
1 3
2 0
2 1
2 3
3 0
3 1
3 2
1 sper 4
0
1
2
3
Cheers, bob
> On Nov 19, 2017, at 11:49 PM, 'Skip Cave' via Programming
> <[email protected]> wrote:
>
> How to find the permutations of y objects taken x at a time?
>
> 3 sper 4
>
> 0 1 2
>
> 0 1 3
>
> 0 2 1
>
> 0 2 3
>
> 0 3 1
>
> 0 3 2
>
> 1 0 2
>
> 1 0 3
>
> 1 2 0
>
> 1 2 3
>
> 1 3 0
>
> 1 3 2
>
> 2 0 1
>
> 2 0 3
>
> 2 1 0
>
> 2 1 3
>
> 2 3 0
>
> 2 3 1
>
> 3 0 1
>
> 3 0 2
>
> 3 1 0
>
> 3 1 2
>
> 3 2 0
>
> 3 2 1
>
>
> 2 sper 4
>
> 0 1
>
> 0 2
>
> 0 3
>
> 1 0
>
> 1 2
>
> 1 3
>
> 2 0
>
> 2 1
>
> 2 3
>
> 3 0
>
> 3 1
>
> 3 2
>
> 1 sper 4
> 0
> 1
> 2
> 3
>
> Skip
> ----------------------------------------------------------------------
> 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