[Haskell-cafe] A round of golf

Kurt Hutchinson kelanslists at gmail.com
Thu Sep 18 13:25:27 EDT 2008


On Thu, Sep 18, 2008 at 1:02 PM, Creighton Hogg <wchogg at gmail.com> wrote:
> Hey Haskell,
> So for a fairly inane reason, I ended up taking a couple of minutes
> and writing a program that would spit out, to the console, the number
> of lines in a file.  Off the top of my head, I came up with this which

Yay, golf! I love playing golf from my Perl days. How about this:

  main = print . length . lines =<< readFile . head =<< getArgs

Salt with Bytestring for extra flavor (and speed).

Kurt


More information about the Haskell-Cafe mailing list