A “Monte Hall” problem solved in Haskell

I’ve just written a solution to today’s Programming Praxis puzzle, which requires you, essentially, to write a Monte Carlo attack on the Monty Hall problem. Thus, the awful pun in this post’s title, in case you missed it. ;-)

Here’s my solution.

It was a lot of fun. I started out feeling like I should be able to do it, but not quite knowing what direction to take, so first of all I was writing some data types for things like Door = Car | Goat, etc. but pretty quickly realised it was just a matter of door numbers. My first working solution was actually a bit longer, because of some intermediate steps (for example the first thing I figured out, in its own function, was how to compute which goat door would get shown to the player given a (car, choice) pair). Then hlint gave me a couple of hints, like using replicateM, and I compacted it down to what we see here. I’m sure it has naive aspects, but I’m pretty happy with it — and I’m loving doing the Praxis problems.

DIY magnetic spice rack

I love this idea [via lifehacker].

Shake a shake a shake a tail feather

You haven’t experienced true joy until you’ve watched this cockatoo dancing to Ray Charles [via nicolas].

Alan Dix on “Language and Action: sequential associative parsing”

Alan Dix on the difference between how humans parse language, and how machines do so — and associated impacts on interaction. Interesting stuff, as ever.

Eastside Roots

Heading to Cornwall on a train last Friday, I spotted something interesting as we neared Bristol Temple Meads: Eastside Roots, a community gardening project — look out for it by Stapleton Road station.

I once told her…

I am that man.

(Shame the sound quality on the video’s so poor though.)

“Believe Me, It’s Torture”

Christopher Hitchens gets waterboarded [via Dawkins].

The evolution of the eye

Anti-evolutionists sometimes use the human eye as an argument for a creator; here’s David Attenborough explaining why that’s tosh [via frosty].

If Philosophers Were Programmers

If Philosophers Were Programmers [brunns].

Nice to see that Wittgenstein (or at least, one of the Wittgensteins) is also a Haskell man…

Cassini’s continued mission

Some truly incredible pictures of Saturn and its friends.

« less retromore retro »