News for hackers. Stuff that matters.
Re:Harvard's 1899 Entrance Exam [pdf] by fhars on Saturday April 09, 2011 @04:51AM (#2426803)
But to become a fully erudite member of modern society, you might want to also study

  zipWith :: (a-> b -> c) -> [a] -> [b] -> [c]
:-)
Re:Harvard's 1899 Entrance Exam [pdf] by aristidb on Saturday April 09, 2011 @06:14AM (#2426900)
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)
Re:Harvard's 1899 Entrance Exam [pdf] by ahh on Saturday April 09, 2011 @09:07PM (#2428542)
Your second example does not typecheck.
Re:Harvard's 1899 Entrance Exam [pdf] by aristidb on Sunday April 10, 2011 @09:18PM (#2430929)
It does.

let fibs = 1 : 1 : (zipWith (+) `ap` tail) fibs in fibs :: (Num a) => [a]

according to ghci 6.12.1

Re:Harvard's 1899 Entrance Exam [pdf] by ahh on Wednesday April 13, 2011 @12:06AM (#2440711)
I get No instance for (Monad ((->) [a])) -am I missing some module include?