Parse error in pattern: n + 1

Viewed 3420

Trying to load a function within a file:

Prelude> :load "prova.hs"

prova.hs:37:9: Parse error in pattern: n + 1
[1 of 1] Compiling Main             ( prova.hs, interpreted )
Failed, modules loaded: none.
Prelude> 

This should create a list which contains n times the repeated value x:

ripeti :: Int -> a -> [a]
ripeti 0 x = []
ripeti (n+1) x = x:(ripeti n x)

What's wrong with it?

1 Answers
Related