The following verbs find all size x combinations of i.y, in lexicographic order:
comb=: 4 : 0 k=. i.>:d=.y-x z=. (d$<i.0 0),<i.1 0 for. i.x do. z=. k ,.&.> ,&.>/\. >:&.> z end. ; z ) comb1=: ((= +/"1) |.@:[EMAIL PROTECTED] ]) #:@i.@(2&^) For example, 3 comb 5 . However, comb takes time and space linear in the size of the result whereas comb1 takes exponential. Yet comb1 would have been preferred according to the "number of characters" criterion. The same point can be made with other programming problems, such as: compositions permutations self-upgrading permutations self-downgrading permutations ----- Original Message ----- From: greg heil <[EMAIL PROTECTED]> Date: Thursday, August 31, 2006 8:05 am Subject: Re: [Jprogramming] Re: Sierpinski triangle > Number of characters is best. It shows the compressibility of the > language, as well as the solution. Eg Arthur notes, with some pride, > that running his K code through a zip compressor yields no benefit. > Hopefully such a goal is attainable in J.Perhaps someday inflected > vocabulary can have single unicode alternatives... Then it will be > like the old days with APL keyboards. With a character metric we can > have cross language comparisons. ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
