Past Meetings‎ > ‎

Clojure Ants demo (May 2009)

Date: May 5, 2009

Location: Linux Caffe

  • Mark Bolusmjak
  • Ian
  • Rick Innis
  • Paul Tarvydas
  • Justin
  • Vish Singh

Vish brought in his laptop and demoed Rich Hickey's multithreaded "ants" simulation.
  • Vish got ants.clj running on his laptop. We watched the ants simulation, in which ants obtain food and bring it back to their nest.
  • After reviewing this month's debate on the mailing list, we were curious as to how the ants simulation would perform if it were modified to be single-threaded.
  • Vish quickly modified ants.clj to create ants-st.clj, a single-threaded implementation of the same algorithm.
  • Visually the single-threaded implementation appeared much smoother, due to lacking the overhead of ~50 threads.
  • However, we understand that the ants simulation is meant as an exposition of Clojure's multithreading capabilities, and it succeeds at that. In practice, there is no reason to run every ant on its own thread, unless you actually have ~50 processors.
  • Vish demoed his Sudoku solver written in Clojure (source code is attached to previous meeting minutes).
  • We also took a look at how lazy sequences work in Clojure, with the help of the ebook version of Programming Clojure, by Stuart Halloway.
  • Ian wants to play around with getting Compojure, the Clojure web framework, running on Slicehost.
  • We discussed whether it would be useful to advertise these meetings on comp.lang.lisp.

The files ants.clj and ants-st.clj are attached below.

Vishvajit Singh,
Aug 9, 2009, 6:54 PM
Vishvajit Singh,
Aug 9, 2009, 6:54 PM