Luke Gorrie (lukego) wrote,
Luke Gorrie

Strange company

I had fun unicycling around Stockholm with the illustrious Haskell hacker Shae Erisson on the weekend. It was really interesting to spend some hours talking about programming and computer science with a proper Haskell guy and I was relieved that we disagreed about almost everything. :-)

I was also excited to discover that other people actually do tricks on unicycles!

He did succeed in reminding me why Haskell matters: it's because Haskell people can rewrite any one of your programs in half as much code. They're the masters of expression.

For a relevant example I could see that the very simple Liskell example at ILC:

(define (fact n)              
  (if (= n 0)
      (* n (fact (- n 1)))))
which was shown transposed into Haskell as roughly:
fact n =
  if n = 0
    then 1
    else n * (fact n-1)
would be shorter even in Erlang-accented Haskell:
fact 0 = 1
fact n = n * (fact n-1)
and suspected it would be a one-liner to a true Haskellite, which turns out to be so:
fact n = product [1..n]
.. not that I think Clemens meant for factorial to be the knockout punch of course, but I found the example provocative. :-)

So thanks for popping by Shae!

Tags: general, haskell
  • Post a new comment


    default userpic
    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.