Ants: locks vs stm
groups.google.com
groups.google.com
I did notice one thing, though. Assuming that what Rich Hickey's saying is true, it would be better to point to something visible that the demo does that the knockoff can't do. If it's possible to appear to reproduce a demo without doing the hard parts, then maybe the demo wasn't actually demonstrating the hard parts. In that case a better demo would be a good idea. Such things can be hard to come by, though, as demos tend to be relatively simple and thus knockoffable.
Locks vs. STM will play out about the same way. It's hard to demonstrate all the things you don't have to care about with GC. Making a good demo that shows you don't need to worry about memory leaks, double freeing, memory corruption, etc is hard. The same is true of making a good demo for STM that illustrates all of the problems you don't have to worry about compared to locks.
I think the ants demo is a good idea technically. Now it just needs a set of "rules", similar to what Rich just posted.
It may be that there isn't a program that's both complex enough to make the problem visible and small enough to count as a demo. In that case, it might be better to call it a sample.
If it were my demo I'd focus on making the value visible. For example, if the value is correctness, then make it obvious when the state becomes incorrect. An incorrect program ought to hit this if it runs long enough.
(flet ((make-random-move (rankf)
(loop for place in places
for rank = (funcall rankf place)
collect (cons place rank) into ranks
sum rank into ranks-total
finally (loop with r = (if (zerop ranks-total) -1
(random ranks-total))
for (place . rank) in (shuffle ranks)
sum rank into current-ranks-total
when (< r current-ranks-total)
do (cond ((and (eq place ahead) (move ant)))
((eq place ahead-left)
(turn ant -1))
((eq place ahead-right)
(turn ant +1)))))))
(if (ant-food ant)This might as well be the poster child for why LOOP is an awesome macro.
Had he watched the Clojure concurrency video in which Rich extensively discusses the ant colony simulation and its purpose, he might not have made that mistake: