[Haskell-cafe] Re: On the verge of ... giving up!
Peter Verswyvelen
bf3 at telenet.be
Sun Oct 14 15:16:56 EDT 2007
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
More information about the Haskell-Cafe
mailing list