I want to make a function in haskell that given a list of single digits, i make the full number. I was thinking in using intensive lists and patrons, as the code it follows:
funcion5 (x:xs) = [y*(10^w) | y <- (x:xs) w]
The idea is, to go over the list and multiplie each digit to 10 pow to the position of the number. Finally i only have to sum all digits and I have the number as this:
sum (funcion5 (x:xs))
Can anyone help me, please? Thanks
This may simply be done by folding with
foldl1 :: Foldable t => (a -> a -> a) -> t a -> a
as follows;