Congrats on writing and running some real Clojure code of your own!
In the latest Clojure 1.3 pre-release snapshot, my error looks like this:
The name of the file (
tmp.clj) and line number (6) causing the error are right there. From the message itself I can see I was trying to use a boolean value (true or false) as if it were an
IFn, which is short for Function Interface. This almost always means there's an expression at the beginning of a set of parens that isn't actually a function. And of course that's the problem here -- the result of
(zero? ...) is a boolean, and since that was wrapped in another set of parens, Clojure was trying to
call the boolean, as if it were a function.
If that's not sufficient detail, you can use
(pst) afterwards at the REPL and you'll see something like this:
This doesn't help much in our case, but what it's showing here is the full stack trace, from the function that cause the error at the top, all the way back to [tt]eval[\tt] function in the repl that started it all. Note that I'm running a slightly customized repl, so my stack trace may look a bit different from yours. Anyway, this kind of full stack trace is frequently useful in larger programs.
If you're using Clojure 1.2, things aren't quite so pretty:
Here it's pointing to a file and line number that is not helpful, so looking at the full stack trace may be worth while. To do that in Clojure 1.2, you must write
(.printStackTrace *e), which presents you with this loveliness:
That's pretty daunting, but don't panic -- the details you want are in there. As we describe in the book, start with the root cause near the bottom of that listing, the last place it says "Caused by". Now, look at the following line and there's the information pointing you to exactly which line of your file was causing the problem -- tmp.clj line 6.
You can see some improvements have been made in this arena in recent versions of Clojure.