How about this?
perm=: [EMAIL PROTECTED] A. i.
perm 3
0 1 2
0 2 1
1 0 2
1 2 0
2 0 1
2 1 0
data=: 10 20 30
f=: ] {~ [: perm [
3 f data
10 20 30
10 30 20
20 10 30
20 30 10
30 10 20
30 20 10
Linda
In a message dated 3/20/2006 7:28:41 PM Eastern Standard Time,
[EMAIL PROTECTED] writes:
> There's an easier way to do it.
>
> perm=: [EMAIL PROTECTED] A. i.
> perm 3
> 0 1 2
> 0 2 1
> 1 0 2
> 1 2 0
> 2 0 1
> 2 1 0
> data=: 10 20 30
>
> {&data perm 3
> 10 20 30
> 10 30 20
> 20 10 30
> 20 30 10
> 30 10 20
> 30 20 10
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm