3.1. Fibonnaci with Lists
fibs = [0,1] ++ [a+b | (a,b) <- zip fibs (tail fibs) ] -- zip is defined as: -- zip (x:xs) (y:xs) = (x,y) : zip xs ys -- zip xs ys = [] |
fibs = [0,1] ++ [a+b | (a,b) <- zip fibs (tail fibs) ] -- zip is defined as: -- zip (x:xs) (y:xs) = (x,y) : zip xs ys -- zip xs ys = [] |
Written by Shlomi Fish