But to become a fully erudite member of modern society, you might want to also study
zipWith :: (a-> b -> c) -> [a] -> [b] -> [c]
:-)Allowing one to simplify to:
fibs = 1 : 1 : zipWith (+) fibs (tail fibs)
Involving zip`ap`tail, the Aztec god of consecutive numbers: fibs = 1 : 1 : (zipWith (+) `ap` tail) fibs
Or, pointlessly: fix $ (1:) . (1:) . (zipWith (+) `ap` tail)Your second example does not typecheck.
It does.
let fibs = 1 : 1 : (zipWith (+) `ap` tail) fibs in fibs :: (Num a) => [a]
according to ghci 6.12.1
edit:
It's interesting. I do have a certain romantic attachment to this kind of classic humanist education, e.g. it irks me that the history and geography section has me floundered and I'm somewhat sorry that I didn't have the drive to do better in Latin in school.
But then I think, there's so much other interesting things to know and experience. At times when I wish I could read Cicero's Orationes In Catilinam in its original form, I need to remind myself that I can read and understand, say, this little piece of genius: