As I keep going backward in this thread, here's another thought.
Here was perms:
perms=: [: |: ([: i. ! ) A. i.
perms
[: |: ([: i. !) A. i.
Try to write the explicit version. You may not see the fork. But look at the
tree:
5!:4 <'perms'
┌─ [:
├─ |:
│ ┌─ [:
──┤ ┌────┼─ i.
│ │ └─ !
└────┼─ A.
└─ i.
After some false starts it worked.
└─ i.
f=: 13 :'|:(([:i.!) A. i.)y'
f
[: |: ([: i. !) A. i.
Linda
-----Original Message-----
From: Programming <[email protected]> On Behalf Of Linda
Alvord
Sent: Saturday, December 8, 2018 1:54 AM
To: [email protected]
Subject: Re: [Jprogramming] Boxed indices,Message-ID:
David, I couldn't resist removing all the @'s ! That is nice!
u=: 13 :'([: ([:([:<~.)|:)\ [: |: (A.~ [:i.[:!#)) y'
'
v
[: ([: ([: < ~.) |:)\ [: |: (A.~ ([: i. [: ! #))
v 'abcd'
┌─┬──┬───┬────┐
│a│ab│abc│abcd│
│b│ac│abd│abdc│
│c│ad│acb│acbd│
│d│ba│acd│acdb│
│ │bc│adb│adbc│
│ │bd│adc│adcb│
│ │ca│bac│bacd│
│ │cb│bad│badc│
│ │cd│bca│bcad│
│ │da│bcd│bcda│
│ │db│bda│bdac│
│ │dc│bdc│bdca│
│ │ │cab│cabd│
│ │ │cad│cadb│
│ │ │cba│cbad│
│ │ │cbd│cbda│
│ │ │cda│cdab│
│ │ │cdb│cdba│
│ │ │dab│dabc│
│ │ │dac│dacb│
│ │ │dba│dbac│
│ │ │dbc│dbca│
│ │ │dca│dcab│
│ │ │dcb│dcba│
└─┴──┴───┴────┘
Linda
-----Original Message-----
From: Programming <[email protected]> On Behalf Of David
Lambert
Sent: Thursday, December 6, 2018 10:35 AM
To: programming <[email protected]>
Subject: Re: [Jprogramming] Boxed indices,Message-ID:
|: (A.~ i.@!@#) 'abcd' NB. generate the permutationsdirectly
aaaaaabbbbbbccccccdddddd bbccddaaccddaabbddaabbcc cdbdbccdadacbdadabbcacab
dcdbcbdcdacadbdabacbcaba
NB. find the subsets within
([: <@~.@|:\ [: |: (A.~ i.@!@#)) 'abcd'
┌─┬──┬───┬────┐
│a│ab│abc│abcd│
│b│ac│abd│abdc│
│c│ad│acb│acbd│
│d│ba│acd│acdb│
│ │bc│adb│adbc│
│ │bd│adc│adcb│
│ │ca│bac│bacd│
│ │cb│bad│badc│
│ │cd│bca│bcad│
│ │da│bcd│bcda│
│ │db│bda│bdac│
│ │dc│bdc│bdca│
│ │ │cab│cabd│
│ │ │cad│cadb│
│ │ │cba│cbad│
│ │ │cbd│cbda│
│ │ │cda│cdab│
│ │ │cdb│cdba│
│ │ │dab│dabc│
│ │ │dac│dacb│
│ │ │dba│dbac│
│ │ │dbc│dbca│
│ │ │dca│dcab│
│ │ │dcb│dcba│
└─┴──┴───┴────┘
On 12/6/18 7:00 AM, [email protected] wrote:
> Date: Wed, 5 Dec 2018 19:45:51 -0600
> From: Skip Cave<[email protected]>
> To:"[email protected]" <[email protected]>
> Subject: [Jprogramming] Boxed indices
> Message-ID:
> <caj8lg_dqrajrtogrm0grouokjnjabvhvmguaoa3gd94w9u6...@mail.gmail.com>
> Content-Type: text/plain; charset="UTF-8"
>
> I want to generate all the 1, 2, 3, & 4 permutations of 4 items.
> I can generate the indices:
>
> (1 2 3 4 perm each 4)
----------------------------------------------------------------------
For information about J forums see
https://nam04.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.jsoftware.com%2Fforums.htm&data=02%7C01%7C%7C48dea38443514cc3aaa008d65cd9eb96%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636798488359011129&sdata=my4onjNy3qOWWFomagGTKDXZwAzt3Lf6sLUxB%2B8briA%3D&reserved=0
----------------------------------------------------------------------
For information about J forums see
https://nam04.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.jsoftware.com%2Fforums.htm&data=02%7C01%7C%7C48dea38443514cc3aaa008d65cd9eb96%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636798488359011129&sdata=my4onjNy3qOWWFomagGTKDXZwAzt3Lf6sLUxB%2B8briA%3D&reserved=0
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm