As a recent thread discussed, a boolean such as 1 1 1 0 1 1 1 0 0 1 1 1
can be regarded as a partition of 12, namely 3 1 3 2 3 You can use the part verb to generate all partitions of the required length, and extract those that suit. You also need to permute their ordering: the part verb yields each set in descending order. This might be useful, or it might be easier just to apply Raul's method if space allows. Mike On 14/10/2011 7:25 PM, David Vaughan wrote: > Thanks all. > > On a similar note, how might one approach the problem of trying to > essentially create all boolean lists of a particular size where there are at > least n 1's in a row? So for example, if n is 3, 1 1 1 0 1 1 1 0 0 1 1 1 is > accepted. I have a filter for checking whether any list is accepted, but not > for generating all of them, specifically any lists where there are more than > 2 groups of consecutive 1's. How could I either get this list 'directly' or > generate every possible list (and then use my filter)? > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
