recursion - Recursive functions with multiple arguments Haskell -
A very simple question: I want to apply multiples of 2 integers in Haskell. I do not compile what I wrote:
mult :: int -> Int - & gt; The problem is the last statement I tried to write:
Pre> mult xy = x + (mult x-1 y) and
mult xy = x + (multiplexed by x- 1, y)) The error I get is:
could not match the expected actual type `int -> Type 'Int' in the IT returns' call type 'multi' I do not know that the compiler says that mult come back to a Goes - & gt; IT when it explicitly returns Int .
You have to put x-1 in parentheses! Like mult xy = x + (mult (x-1) y) By the way, it does not count x and multiply Y: ) Try some examples ... this is just a little mistake.
Comments
Post a Comment