[Haskell-cafe] Where's the error in this snippet of code?

Alex Gontcharov alexg005 at hotmail.com
Thu Mar 25 03:36:34 EST 2004


Ignore the layout
I can't find the error, running it gives parse error during compile on
pStack, it is not very descriptive and I don't what is wrong.

--Stack for the digits for numbers, a modulo b
    digStack :: Integer->Integer->[Integer]
    digStack a b
      | a == 0 = []
      | otherwise = (mod a b):(digStack (div a b) b)
                     
                     --Takes a list of remainders and
                     pStack :: [Integer] -> Integer -> [Integer]
                     pStack [] _ = []
                     pStack (x:xs) a =
                        digStack x a ++ pStack xs

I think I will never like Haskell :-)


More information about the Haskell-Cafe mailing list