In this case? I'd probably use ;: but for the general case it's probably safer to use <"1 (if I understand your intent properly).
Thanks, -- Raul On Tue, Aug 15, 2017 at 2:40 PM, Skip Cave <s...@caveconsulting.com> wrote: > How could you box each string? > > Skip Cave > Cave Consulting LLC > > On Tue, Aug 15, 2017 at 12:07 PM, Raul Miller <rauldmil...@gmail.com> wrote: > >> I'd meet that specification like this: >> >> require'stats' >> perms=: A.&i.~ ! >> >> gen=:4 :0 >> x{~,/(perms y){"1/y comb #x >> ) >> >> But note that the result format is different. >> >> Thanks, >> >> -- >> Raul >> >> On Tue, Aug 15, 2017 at 12:58 PM, Skip Cave <s...@caveconsulting.com> >> wrote: >> > I believe that the general case would be: >> > Design a J verb that will generate all possible unique strings of a >> > specific fixed length using only specified set of symbols, where each >> > generated string has no repeated symbols. >> > >> > x gen y >> > >> > Where x specifies a set of symbols (characters, numbers), and y specifies >> > the symbol string length (this length must be the same or less than the >> > number of symbols) >> > >> > '12ab' gen 3 >> > 12a 12b 1a2 1b2 1ab 1ba 21a 21b 2a1 2b1 a12 a21 a1b a2b b12 b21 ..... >> > >> > Then one could really test algorithm efficiency using large symbol sets >> and >> > large string lengths. >> > >> > Skip >> > >> > >> > Skip Cave >> > Cave Consulting LLC >> > >> > On Tue, Aug 15, 2017 at 11:32 AM, Don Guinn <dongu...@gmail.com> wrote: >> > >> >> For really big problems you could go to a larger base than 10 like >> >> hexadecimal. Or even bigger using more letters. >> >> >> >> On Tue, Aug 15, 2017 at 10:10 AM, Raul Miller <rauldmil...@gmail.com> >> >> wrote: >> >> >> >> > To compare them for equality you need to sort them. >> >> > >> >> > However, the task was to generate the integers. >> >> > >> >> > (If the example list of numbers was a part of the specification then >> >> > we probably should not be considering seven digit integers as >> >> > relevant.) >> >> > >> >> > Thanks, >> >> > >> >> > -- >> >> > Raul >> >> > >> >> > On Tue, Aug 15, 2017 at 10:37 AM, Arie Groeneveld >> >> > <agroeneveld...@gmail.com> wrote: >> >> > > To compare both you need to do the following: >> >> > > >> >> > > 10 ts 'R=./:~,10#.(perms 7){"1/1+7 comb 9' >> >> > > 0.0288779 2.4132e7 >> >> > > 10 ts 'G=.,10 #. ((],"1 0 -."1)^:6 ,.)1+i.9' >> >> > > 0.0258377 2.30737e7 >> >> > > R-:G >> >> > > 1 >> >> > > >> >> > > Looks like a draw. >> >> > > >> >> > > >> >> > > Op 15-08-17 om 16:16 schreef Raul Miller: >> >> > >> >> >> > >> I cannot comment on elegance, but I can disagree about the >> efficiency >> >> > >> issue: >> >> > >> >> >> > >> timespacex ',10#.(perms 7){"1/1+7 comb 9' >> >> > >> 0.015591 2.15104e7 >> >> > >> timespacex '10 #. (,/@:(],"1 0 -."1)^:6 ,.)1+i.9' >> >> > >> 0.036695 3.7755e7 >> >> > >> >> >> > >> Thanks, >> >> > >> >> >> > > >> >> > > ------------------------------------------------------------ >> ---------- >> >> > > 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 >> ---------------------------------------------------------------------- >> 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