Jan 14, 2011

Haskell vs Python

I was playing solving some problems with Haskell and I was impressed by its readability that I wanted to share with you. Like we say in Python: "Readability counts"... just in this case is Haskell the more readable.

7 comments:

  1. maybe a tad more readable python version (you don't have to understand the slicing):

    " ".join(reversed("around the world".split()))

    ReplyDelete
  2. Yes, it makes sense, and very cool :-).

    ReplyDelete
  3. The Haskell version looks slightly better. But neither version looks incredibly readable.

    ReplyDelete
  4. Haskell is a beautiful language, it just takes some time to get used to it. Can't sat anything about Python, but i'm trying it out.

    Be as it may, FP is here to stay. You'd better get used to the idea. Or go to do some COBOL legacy maintenance... YUCK !!

    ReplyDelete
  5. Or...

    unwords . reverse . words $ "around the world"

    is how I'd do it. I'm fairly proficient in Haskell, and I'm really loving everything. Wonderful language.

    ReplyDelete

disclaimer



Things written in this blog are my personal thoughts or points of view, and do not represent at all the position of my employer.

Code in the website is licensed under The MIT License

Content of this blog is:
Creative Commons License
Licensed under a Creative Commons Attribution-Share Alike 3.0 Unported License.