Well, I had to do a function that, given a list and a number, returns the list element that is in that position (the number).
Basically it is the function already defined. The problem is that I have to restrict the function in case the given number is greater than the existing positions.
I have tried a where
but it gives error. Can I put this where
? If, in what situations can I use where
?
localiza:: [a]->Int->a
localiza [a] 0 = a
localiza (a:as) b = localiza (as) (b-1)
where b+1<=length(a)
of this error: parse error on input 'where'