Clojure Convinces Tim Bray to Code in a LISP

November 22, 2009

I was catching up on unread RSS feeds this morning, and I came across these two posts, from earlier in the month, in which superblogger Tim Bray, who has repeatedly sworn he would never program in any LISP, talks about programming a Clojure version of his wide-finder parallel-programming challenge project. His posts are here:

  1. — References
  2. — Parallel I/O

I recommend taking a close look at both posts. Bray is a clear thinker and excellent writer, so his code and explanations are not hard to follow. Also, the posts are worthwhile for the helpful “you are doing it wrong” comments posted below. It shows what a strong and helpful community Clojure has.

Clojure training in Reston, with Rich and Stu, next year

October 7, 2009

Thanks to Paul for pointing this out: the Pragmatic Programmers training series is offering a 3-day training course in Reston, VA next year (date TBD). Clojure’s creator Rich Hickey and Stuart Halloway will be instructing. More information is at the Pragmatic Programmers site.

It looks like the course will assume you know something about Lisp or Java and functional programming, and possibly concurrency, but nothing about Clojure. It’s going to go well beyond basics, though, and it’s a chance to ask Rick Hickey questions directly.

It’s going to be expensive, with the alumni/group discount rate still a hefty $1195. The early bird price is $1495. I’ve been to the Advanced Ruby course of the same dimensions and cost, and it was worth it. If you all want to join up, 3 or more of us can get the group rate and save a few hundred dollars each.

Clojure 1.0 and git

July 3, 2009

I’m chipping away at my Mashup project tasks, namely an OAuth library for Twitter and other providers of protected resources. But I wanted to pass on a concrete contribution, so here are some tips about taking advantage of Clojure’s availability through git, and how to put your clojure-contrib library in sync with the big Clojure 1.0 release.

Read the rest of this entry »

Unofficial Clojure 1.0 release candidate

April 28, 2009

Clojure 1.0 is on the way, and as a result a lot of activity is occurring in the Subversion repository.  Revision 1357 of the Clojure source was proclaimed the likely release candidate, although a few minor changes have been checked in since.  Likewise, clojure-contrib revision 723 is the likely release candidate corresponding to 1.0. It should be interesting to watch what unfolds in the source until the actual release.

It’s not too late to contribute, and no contribution is too small.


Meeting recap, Pipes/Tubes/Clinks, and next meeting info

April 6, 2009

At our latest meeting, we discussed macros and adopted a capstone project, an open-source Clojure implementation of some of the functions of Yahoo Pipes.


Regarding macros, we touched on the chain of events when a Clojure program is evaluated: evaluation runs from top to bottom, and each S-expression is macro-expanded (if possible) and then evaluated. If an expression expands into something that itself contains a macro, the the new macro expression will be expanded before it is evaluated. This allows a macro to use a previously defined function in the determination of its expansion.

“Macros” in Lisp are very different from “macros” in other languages, as they allow the programmer to use all the power of Lisp to determine the macro’s expansion. Macros are not first-class members of the Clojure language, however. You cannot use them as you use functions–you can not use them with map or apply, for example–because macroexpansion happens before an expression can be used in this way.

Seeing stars

We also talked about “star” functions and macros. The macroexpansion of an expression that uses ‘and‘ includes something called let*:

(macroexpand '(and 1 2 3))
->(let* [and__2863 1]
(if and__2863 (clojure.core/and 2 3) and__2863))

We concluded that you really aren’t supposed to see let*. You only do in this case because macroexpand completely expands the expression it is given, and it turns out that let is a macro whose definition includes the mysterious let*. In fact, a lot of Clojure’s core macros use “star” constructs that appear to be special forms. Some digging at the REPL confirmed that they are not symbols. Likely the “star” forms are transformed by the Clojure parser directly into Java. If you have some special knowledge about this, please post a comment or join our discussion group. We’d like to know more.

Capstone project

Luke presented the case for a project that implemented some of the Yahoo Pipes application. By general acclamation we adopted this project as our capstone. We’ve decided to spend the next two weeks hacking on the basic problems of the project ourselves, keeping in touch through the group mailing list. David set up a github repo for us, with a wiki for collaboration. There you can find the summary of our initial work on defining the project, thanks to Keith. Serge dug up Yahoo’s Pipes documentation.

We’re calling this Tubes right now (as in “teh tubes”), but a final decision on the name (I’m not saying I don’t like Tubes) is one of many tasks we’re deferring. Right now we just want to get things moving. Personally, I expect Paul to have it all done by this afternoon.

Multimethods on Sunday, April 19th, 1pm

Our next meeting will be at least partly devoted to the final topic in Stu’s book: multimethods. Read chapter 8 of Programming Clojure and bring any questions or comments you’d like to discuss. Please notice two things about the next meeting date: 1) it is in two weeks, not three; and 2) it is on a Sunday. The location is still HacDC’s meeting space at St. Stephens, and the time is still 1pm. We hope to see you there.

Project Proposal: Clojure Pipes

March 30, 2009

This Saturday, April 4, at our face-to-face meeting at HacDC, member Luke VanderHart will informally present a case for a Yahoo Pipes-like content aggregator as a possible capstone project. Interested?

Read up on Pipes.

Read Luke’s initial comments.

Of course, we’ll also discuss macros, including the material in Chapter 7 of Programming Clojure.

We hope to see you there: 1PM at HacDC.

March 14 meeting recap, next meeting April 4

March 16, 2009

We had another successful meeting at HacDC’s workshop on Saturday. We covered functional programming, walking through the concepts in the chapter from Programming Clojure and then putting them to work in translating a decision tree modeling program from Python to Clojure: watch for a separate announcement on how we will continue to work on that. We had an especially good time unraveling this bit of code…

(def head-fibo (lazy-cat [0 1] (map + head-fibo 
                                      (rest head-fibo))))

…and understanding what’s less than optimal about it: that it keeps a reference to the head of a lazy sequence, and thus (nth head-fibo x) fails for large values of x.

Next, we’ll tackle macros on April 4th, at 1PM, at HacDC’s workshop. The reading is Chapter 7 of Programming Clojure. We’ll be looking at simple implementations of defmacro and reviewing different uses for macros. We may also tackle a bit of Paul’s proposed templating language, putting what we’ve learned to use. Hope to see you there!