How to keep your Clojure environment current

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.)

Advertisements

Next meeting: Saturday, January 3, at 1pm

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:

  1. 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.
  2. 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.
  3. 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.


Smashing first meeting

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.

December 7, 2008 at Chief Ike's Mambo Room

Our first meeting: December 7, 2008 at Chief Ike's Mambo Room


Code walkthrough in Hickey presentation

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.


Clojure Roundup: Post-Thanksgiving vacation edition

December 1, 2008

I will try to post Clojure roundups as often as I can… best laid plans of mice and men and all that.

Over at Lambda the Ultimate there is a brief discussion about the recent inclusion of trampolining for mutual recursion added to recent Clojure builds.

Rich Hickey’s presentation at the 2008 JVM Languages Sumit is a must watch.

Bill Clementson gives a nice overview of getting on-demand Java documentation rolled into EMACS Slime mode for Clojure.  More recently, Mr. Clementson posed that Clojure is the language for concurrency-oriented programming.

Our own Craig Andera does some insanity with C# and Clojure.

Clojure recently incorporated a new regex syntax.

That’s all for now.  Add anything that I missed to the comments section.

-m