[Haskell-cafe] All binary strings of a given length
Eugene Kirpichov
ekirpichov at gmail.com
Fri Oct 15 08:22:23 EDT 2010
genbin = flip replicateM "01"
2010/10/15 rgowka1 <rgowka1 at gmail.com>:
> Hi -
>
> How can I generate all binary string of a given length? The type
> signature would something like -
>
> genbin :: Int -> [String]
>
> For example genbin 2 would give ["00","11","01","10"] and genbin 3
> would give ["000","001","010","011","100","101","110","111"] etc..
>
> thanks..
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
--
Eugene Kirpichov
Senior Software Engineer,
Grid Dynamics http://www.griddynamics.com/
More information about the Haskell-Cafe
mailing list