Hello,

After a short holiday I now studying chapter 6 of this book.

For the first exercise I have to make the function for ^ for postitive numbers.

So I did these steps.

Step 1 : Defining the type

^ :: [Int] -> Int

Step 2 : enumarate the cases

^ []  =
^ [n, 0] =
^ [n, ns] =

Step 3 : Define the simple cases

^ []  = []
^ [n.0] = 1

Step 4 : Define the other cases

^[n.ns] = n * ^ns

Step 5 : generalize and simplify :

^[] = []
^[-, 0] = 1

So the whole function would be :

^ :: [Int] -> Int
^[]   = []
^[-, 0] = 1
^ [n,ns] = n * ^ns

But the answer in the book only says :

m ^ 0 = 1
m (n+1) = m * m ^n

so no type defenition and a whole different solution to the last rule.

So my question is : Is what I did wrong ?

Roelof