February 22, 2009
The Study Group met on February 21st at 1PM at HacDC’s workshop to continue our discussion of concurrency.
We worked through Stuart Halloway’s snake program, taking note of the way he organized his program by separating the functions that dealt only with immutable data from the ones that dealt with changes in state. We noted his use of “update-” at the beginning of his names for the state-aware functions, and we agreed this was a pretty good convention for functions that were going to update the state of some refs, agents, or atoms. We also paid a fair amount of attention to his consistent use of destructuring as well as the syntax for the alter function. Finally, we looked at Halloway’s atom-snake, which actually stores the state of the entire snake game in an atom and updates it with swap!, and in so doing creates a transaction-free version of the game. This precipitated a discussion of Software Transactional Memory, which allows copies of complex objects, such as the state of a snake game, to be made without duplicating data from original to copy.
Our next meeting is March 14th, at 1PM, at HacDC’s workshop in St. Stephen’s Church in Washington DC. Homework: chapters 5 and 7 (on Functional Programming and Macros) from Stuart Halloway’s Programming Clojure. We hope to see you there.
We’re also starting to consider our capstone project. Watch the Google group for discussions about the project.
Leave a Comment » |
announcement, meeting, organization | Tagged: concurrency, meeting, St. Stephens |
Permalink
Posted by goodmike
February 17, 2009
We’ll be continuing our exploration of concurrency this Saturday at HacDC’s workshop at St. Stephen’s Church, in Northwest DC.
Be sure to check out chapter 6 of Stuart Halloway’s Programming Clojure. It’s the concurrency chapter, and it has some good new stuff in it, including a discussion of atoms and a Clojure snake game that Halloway walks you through fn by fn.
Come with ideas for hacking. I think it might be fun to alter the snake game so you can play against 1+ AI snakes, trying to get those apples. Collisions could eliminate players: think Tron and those light cycles.
Thanks to Serge and HacDC for providing a warm wi-fi-enabled meatspace where we can gather.
Leave a Comment » |
announcement, meeting | Tagged: concurrency, meeting, St. Stephens |
Permalink
Posted by goodmike
January 10, 2009
In the last few weeks, there’s been a fair amount of Clojure news and activity here in our study group. Here are some links to things we’ve been watching.
- A new language release. On December 17th, Rich “cut a new release” of the language. This should bring the offical release up to date enough for most people, although you’re still advised to check out the latest from Subversion, especially a few months go by without another official release
- Streams vs. sequences. A lively discussion about the right implementation(s) of laziness and the role of caching in Clojure’s sequences. There is a move afoot to add true streams to Clojure, although the ramifications of such an addition are uncertain.
- Compojure. Yes, Clojure has its own web framework now, and it looks pretty smart. Its syntax is inspired by Ruby’s Sinatra, it interfaces with Jetty, and it lets you write HTML in a vector-tree fashion that looks odd but probably saves the experienced user lots of keystrokes. Eric Levigne has written some posts about using Compojure to run a website.
- Paul’s article on
bean and Java interop. A nice tip on making it easier (and more Clojure-ish) to work with Java libraries.
- Luke’s Markov chain generator and Michael’s post about it. Luke wrote a cool program that generates an output text from the pieces of an input text and uses pattern analysis and probability to mimic the style of the input text. Your humble blogger responded with a post examining the workings of the program and suggesting ways to build on it. This could become a group project.
That isn’t everything that happened in Clojure lately, not by a long shot, so feel free to comment to ad your own observations. Also, consider joining our study group list (link in the column to the right) to contribute. You don’t have to be in DC or come to meetings–we’d love to hear from you.
1 Comment |
resources | Tagged: 20081217 release, bean, compojure, markov, resources, sequences, streams |
Permalink
Posted by goodmike
January 10, 2009
We will still meet at St. Stephens, in northwest DC, just a week later than we’d initially planned: on the 31st at 1PM, a day before Paul Barry’s beloved Baltimore Ravens take the field in Superbowl 0×2B.
Concurrency is still on the agenda. Watch for an update to the Programming Clojure PDF soon: Stuart Halloway has pledged to try to get us a more complete Concurrency chapter with a discussion of atoms. Thanks, Stuart!
If the door is locked on the 31st, we’ll post a note with my cell phone number for you to call for entry. I hope to see you there.
2 Comments |
announcement, meeting | Tagged: concurrency, meeting, St. Stephens |
Permalink
Posted by goodmike
January 5, 2009
Some of you have noticed that when combined, the latest versions of the set of tools for editing Clojure in Emacs aren’t playing well together. Life on the bleeding edge means occasional paper cuts. I don’t yet understand exactly how Emacs, SLIME, and swank are working together, but I have been able to follow some advice online to fix the troubles I was having.
When starting SLIME in Emacs, everything seemed to work–Emacs and SLIME appeared to be communicating over local ports–but then an error message popped up:
error in process filter: Symbol's function definition is void: slime-redirect-inferior-output
I use Bill Clementson’s emacs setup, which he described on his blog. It turns out Clementson was already aware of the problem, which he describes in a thread on the Clojure mailing list. In a nutshell, swank-clojure has been updated and is a bit out of whack with the other edting tools. A patch has been applied, and if you checkout the latest tools, you’ll now get the patched version. You must then make a minor change to your .emacs file (Preferences.el for me and my Aquamacs setup):
From:
(eval-after-load "slime"
'(progn
(slime-setup)
...
to:
(eval-after-load "slime"
'(progn
(slime-setup '(slime-repl))
And then restart emacs. Works like a charm now. Thank you, Clojure community!
Leave a Comment » |
resources | Tagged: editors, emacs, SLIME |
Permalink
Posted by goodmike
January 5, 2009
** Update: Meeting is rescheduled to Saturday, January 31st, 1PM, at St. Stephens Church. **
Thanks again, everyone, for a great meeting on the 3rd of January. Our next meeting will take place on Saturday the 24th at 1PM in the same location as last time, St. Stephen’s Church at 1525 Newton St NW. We’ll be discussing concurrency.
Your homework for the meeting is the Concurrency chapter in Programming Clojure. Give yourself plenty of time for this text: unless you are familiar with concurrency already, you will probably find this chapter challenging. Concurrency is what Clojure is all about, though, so press on!
Also, please think about little projects or exercises we could undertake in small groups to try out what we’ve learned. Last time we considered card games and exercises from other Lispy textbooks before tackling the Swing app. These might be good ideas again. What kind of concurrent situations come up in software or in real life?
If you haven’t joined us yet or would like to, feel free! We’re still in our tutorial/mentoring
phase, and the environment is welcoming and helpful to novices. If you’re already experienced with Clojure or similar technologies, we’d love to have you join us too.
See you on the 24th.
1 Comment |
announcement, organization |
Permalink
Posted by goodmike
December 11, 2008
The Sourceforge page for Clojure currently lists the September 16, 2008 version as the latest release for download. Unfortunately, a lot has changed in Clojure since then. For example, the syntax for java interop has changed so that a lot of older Clojure code won’t work anymore, and if you’re running the September 16 version, newer code won’t work either: this includes examples from the latest release of Stu Halloway’s Programming Clojure.
Everyone is downloading the source via subversion and building their JARs. This is the de facto latest release. I would advise you to do the same. Here are a few ways to make sure your Clojure is up to date (Thanks to Philip Fominykh, Keith Bennett, and Craig Andera for the help.)
The most straightforward way is installing directly from source (wikibooks).
A more comprehensive solution is offered by Bill Clementson: an organized directory setup with build commands and Emacs/SLIME support. (Aquamacs users, add his ~/.emacs code to your Preferences.el file.)
2 Comments |
resources | Tagged: clojure version, java interop, subversion |
Permalink
Posted by goodmike
December 10, 2008
Our second face-to-face meeting will be held in the auditorium at St. Stephen’s church in Washington, DC. This is a frequent meeting place of HacDC. Thanks to Serge Wroclawski for hooking us up with a great space. The address is 1525 Newton St NW, near the intersection of 16th St NW and Newton. Here is a Google map provided by HacDC showing the church’s location and a path from the Columbia Heights green line Metro station.
Homework
All members are asked to complete the following before our next meeting:
- Get up and running with an editing environment you feel comfortable with. Emacs is the classic choice, though it isn’t the only option. Look for more on Emacs/SLIME and other editors on this blog, and in the study group mailing list.
- Read the Preface and the first four chapters of Programming Clojure. (That means, up to and including “Unifying Data with Sequences”.) A new PDF beta version was just released that takes recent changes in Clojure’s syntax into account.
- Come up with at least one idea for a coding exercise you would like to take part in at the meeting. We’re going to break into small groups and hack some Clojure. Think of tasks that would take about 20 to 30 minutes and that explore some of the ideas in the reading.
I hope to see you on the 3rd.
Leave a Comment » |
announcement, meeting | Tagged: editors, exercises, HacDC, meeting, St. Stephens |
Permalink
Posted by goodmike
December 8, 2008
Our first study group face-to-face meeting was a success. Fifteen people came, some all the way from Baltimore, bringing a wide range of experience and interests to Chief Ike’s storied, if slightly wobbly, tables. Philip Fominykh gave a presentation about using emacs and SLIME to hack Clojure, and then we broke down into smaller, informal chats. It was fantastic to meet everyone, and I’m looking forward to working together in the coming months. There’s real excitement about Clojure here in our nation’s capital.
Big thanks to Chief Ike’s Mambo Room for making the space and helping us get set up.
Our next meeting will take place shortly after New Years. Information on time/place, as well as format, will be posted here.

Our first meeting: December 7, 2008 at Chief Ike's Mambo Room
Leave a Comment » |
announcement | Tagged: Chief Ike, face-to-face, SLIME |
Permalink
Posted by goodmike
December 6, 2008
**Update 12/11/2008: In the original post, I claimed the code from Hickey’s presentation needed to be updated to the latest version of Clojure. Wrong. The code wasn’t running for me because I didn’t have the de facto latest version, which is built from subversion. I’ve edited the post to reflect this. **
Hickey’s presentation to the Western Massachusettes Developers Group is primarily about Concurrency. The first half covers similar topics to his other presentations (including the For Lispers presentation). But about halfway through the talk, at 1:16:00, he begins a walkthrough of a program he wrote simulating an ant colony. I really recommend following this. It’s helped me a lot.
So go view the video:
Get the code for the simulation too, from the link on the Blip page. As of this posting, you’ll need to build clojure from subversion to make the code work. If you’re using the latest official release, from September 16, you’ll need to use a copy of the code I made: http://groups.google.com/group/clojure-study-dc/web/ants.clj.
The key difference is in the java interop syntax. The latest version of clojure uses a dot before a method call in many circumstances, whereas the official release does not. In other words:
(doto g
(.setColor c) ;; current syntax, with dot
...
vs.
(doto g
(setColor c) ;; official release syntax, no dot.
...
If you run current Clojure code using the official release, you’ll see a lot of errors like these:
java.lang.IllegalArgumentException: No matching method found:
.setPreferredSize for class clojure.lang.Proxy__2845
The walkthrough takes about an hour. Give it a try.
Leave a Comment » |
resources | Tagged: anthill, concurrency, resources, walkthrough |
Permalink
Posted by goodmike