[Haskell-beginners] accumenlator problem

Roelof Wobben r.wobben at home.nl
Wed May 13 11:43:20 UTC 2015


Hello,

I have this :

-- | Convert a digit to a list for example 123 becomes [1,2,3]
toDigits :: Integer -> [Integer]
toDigits number
   | number <= 0 = []
   | number > 0 = toDigitsAcc [] number

toDigitsAcc:: [Integer] -> [Integer] -> [Integer]
toDigitsAcc acc number
   | number <= 0  = acc
   | number > 0 = (number `mod` 10) : acc toDigitsAcc (number `div` 10)

bur there are error on both last lines of he functions.

Any tips how to solve this ?

Roelof


---
Dit e-mailbericht is gecontroleerd op virussen met Avast antivirussoftware.
http://www.avast.com



More information about the Beginners mailing list