[Jprogramming] Operations on boolean lists

Raul Miller rauldmiller at gmail.com
Sat Oct 15 02:49:12 HKT 2011


On Fri, Oct 14, 2011 at 2:25 PM, David Vaughan
<purpleblues13 at googlemail.com> wrote:
> 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)?

The simplest way of generating all boolean lists of a given size is:

  #:i.2^size

-- 
Raul


More information about the Programming mailing list