There’s a really neat contest going on as a response to the Obfuscated C contest. The goal is to write a piece of code that solves a particular problem in such a lucid manner that, without comments, lay people would understand your solution. The problem:
Write a program that generates all two-word anagrams of the string “documenting”. Here’s a word list you might want to use: http://pragdave.pragprog.com/data/wordlist.txt.
This Python one-liner is a sufficient solution (isn’t it ironic that the rules of the self-documenting code contest are under-specified?):
[(word1, word2) for word1 in wordList for word2 in wordList]
More seriously, here’s my beautiful Haskell solution. Haskell can be very clean, concise, and elegant if you know the rules, but I’m pretty sure the list comprehensions and higher-order functions would confound the uninitiated.
The Conversation {1 comments}
Hi David,
Thanks for your comment on my blog: http://techismything.blogspot.com/. I’ve removed the article that you were offended by, and want to clear up that the article ‘Appreciating Windows’.
Please have a look at my latest post, to clear up just what I meant. I didn’t have the intention of crediting anyone else for your hard work.
Thanks,
Danny
Leave Your Own Comment
You can follow any responses to this entry via its RSS comments feed. You can also leave a trackback if the inclination is there.