Here’s a problem I ran across on the CompSci Stack Exchange. Suppose you have a biased coin that comes up heads with probability p. You don’t know what p is, but assume it is neither 0 nor 1. How can you use the coin to simulate a fair coin, i.e. one that produces heads with [...]
Archives for September 2010
A thread safe fsm?
Today I wanted to play around with building a small thread-safe finite state machine. I’m mostly interested in the thread safety angle, so the machine is kept extremely simple. Clojure’s protocol feature turned out to be just what the doctor ordered. The fsm consists of three things: the current state, the input alphabet, and a [...]
Clojure Programming Studio: a review
On Sept 13-15 I had the pleasure of attending the Pragmatic Studio’s Clojure Programming course in Reston, VA. This is a brief review. First, the external elements. The course was held at the Learning Tree Reston Education Center. The facility was spacious, modern, and well run. There was good food, plenty of drinks and snacks, [...]
bind, unit, and all that
I’ve given in to the unholy urge to write a monad tutorial. Here are some remarks that might help you decide whether it’s worth your time to read on. My intended readers are programmers interested in functional programming, not mathematicians. No category theory is required. All the code will be in Clojure. The level of [...]
Posts