
14 Oct
2007
14 Oct
'07
7:16 p.m.
apfelmus:
main n = print . sum . map read . take n . reverse . lines =<< getContents Amazing. And so easy to read and understand...
This reminds me of a student how asked me to convert a simple formula to approximate PI from C++ to Haskell. Even although I have over a decade of C++ experience, I could not immediately do it (okay, I also just gave a 3 hours non-stop lecture, so my brain was completely empty ;). But when he gave me the math formula, converting it to Haskell was just a matter of translating the math to Haskell, almost one-to-one.... And that's one of the reasons I want to stick to Haskell for a few more years (at least) :-) Peter