[Haskell-cafe] convert a list of booleans into Word*

Bulat Ziganshin bulat.ziganshin at gmail.com
Wed Sep 30 09:40:41 EDT 2009


Hello Paul,

Wednesday, September 30, 2009, 1:18:03 PM, you wrote:

> I haven't found a function in hackage or in the standard library that
> takes a list of booleans (or a list of 0s and 1s, or a tuple of booleans
> or 0s and 1s) and outputs a Word8 or Word32.

sum . zipWith (*) (map (2^) [0..])


-- 
Best regards,
 Bulat                            mailto:Bulat.Ziganshin at gmail.com



More information about the Haskell-Cafe mailing list