Reposting to correct the inadvertently changed thread head. I should have pointed out that my suggestion works for an arbitrary vector. I chose a triplet, 1 3 5 in order to limit the size of the output. So, also, for example _10{. allpermofallsize 'j807' +----+----+----+----+----+----+----+----+----+----+ |08j7|087j|07j8|078j|7j80|7j08|78j0|780j|70j8|708j| +----+----+----+----+----+----+----+----+----+----+
Sent and somewhat mangled from my iPad Mike > On 6 Dec 2018, at 16:38, Mike Day <mike_liz....@tiscali.co.uk> wrote: > > This was my take, don’t have time to check whether it duplicates/plagiarises > others’ offerings. Apologies for poor formatting from iPad. > > allpermofallsize =: ;@(<<"1@:{~ each(perm ~ each >:@i.) @#) > > #allpermofallsize 1 3 5 > 15 > 10 {. allpermofallsize 1 3 5 > +-+-+-+---+---+---+---+---+---+-----+ > |1|3|5|1 3|3 1|1 5|5 1|3 5|5 3|1 3 5| > +-+-+-+---+---+---+---+---+---+-----+ > > Cheers, > > Mike > > > Please reply to mike_liz....@tiscali.co.uk. > Sent from my iPad > >> On 6 Dec 2018, at 15:35, David Lambert <b49p23t...@gmail.com> wrote: >> >> |: (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, programming-requ...@forums.jsoftware.com wrote: >>> Date: Wed, 5 Dec 2018 19:45:51 -0600 >>> From: Skip Cave<s...@caveconsulting.com> >>> To:"programm...@jsoftware.com" <programm...@jsoftware.com> >>> 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 http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm