6 Mar
2003
6 Mar
'03
2:02 a.m.
Hello,
frombin :: [Bit] -> Int
frombin [] = 0
frombin (n:ns) = sum (n:( frombin (map (*2) ns)))
frombin takes a list of Bits and returns an Int, but (:) needs a list as its second argument. Try something like
frombin (n:ns) = n + 2*(frombin ns)
or
frombin = foldr (\x y->x+2*y) 0
Ciao, Steffen