Alex Gontcharov wrote:
Ignore the layout

pStack needs to be indented to the same level than digStack (or a "where" must be inserted after digStack).


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.

after correct indentation, the error message of ghc is quite accurate:


    Couldn't match `[Integer]' against `Integer -> [Integer]'
        Expected type: [Integer]
        Inferred type: Integer -> [Integer]
    Probable cause: `pStack' is applied to too few arguments in the call
        (pStack xs)
    In the second argument of `(++)', namely `pStack xs'



--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

the last expression should probably be "pStack xs a"


I think I will never like Haskell :-)

Come on, Christian

_______________________________________________
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to