Archive for June, 2008
Five things I hate about Perl
Enough advocacy, let's get to the nitty gritty of 5 things I hate about Perl. (After brian d foy.) The difference between list and scalar context is subtle. One bug that bites people too often is this (for some value of "people", including me, far too often): sub myfunc { return } my $scalar = […]
More Countdown: laziness, Scheme, and German frogs
The Countdown code I showed you isn't really taking advantage of Haskell's laziness. We should only have to check entries up until the point that we have enough matches (in the current code 'take 4 $ getAnagrams') and that's good. However, we have to generate the whole powerset first, so that we can sort it […]
Schwartzian transform in Haskell
In the last post, I mentioned that we might be able to improve the performance of our sort using a "http://en.wikipedia.org/wiki/Schwartzian_transform". This basically involves precaching the expensive calculation (in this case, length), sorting by the cached value, then taking just the original values. Let's test with a list of words: words "If on a winter's […]
Countdown words game solver in Haskell
Will on #geekup has been working on a Countdown letters and numbers game solver written in Python. I thought it'd be fun to try to do it in Haskell, and started with the letters game (anagram) solver. Starting with a string of jumbled letters, the goal is to make the longest possible anagram. I remember […]
Monads in Perl (take 1)
I've been away for a while from Haskell so I thought I should do some revision and really get my head around Monads. While I plodded through the wonderful "meet the monads" tutorial, I decided that the best way to learn would be to do. By implementing Monads in Perl. I'd highly recommend trying to […]