I begin a “new” Fibonacci algorithm, but it’s not working. It’s very simple:
--fiblista 0 n = [0]
--fiblista 1 n = [1]
fiblista a n
| a <= n = (0:1:tail, ((fiblista!!d)+(fiblista!!c))) fiblista a+1 n
where d = a - 1
c = a - 2
Example:

First error code: parse error on input `=’
Any idea how to fix this algorithm?
I read thousand of example Fibonacci algorithm in haskell, but I need to write a new one.
Your indentation is wrong. Try:
But this code still won’t compile.
fiblistais a function with two parameters, but you also try to use it as a list. You also try to use a tuple as a function.If you are still stuck writing your function, it would help if you could describe what the parameters to
fiblistaare, and what it should return. Include a type signature.Is this homework?
So.
fiblista a nis a list of Fibonacci numbers, starting with the ath Fibonacci number, and ending with the (n-1)th Fibonacci number.This is a list question.
Imagine you had a list of all the Fibonacci numbers. (This would be the same as
fiblista 0 ∞, if∞was a valid Haskell value.) You would then be able to use the standard list functionstakeanddropto calculatefiblista a n.