Question

I'm trying to learn clojure. ClojureBox appears to be similar to LispBox - http: //gigamonkeys.com/lispbox/ which I've used previously.

I'm looking for a good clojure specific tutorial on using emacs as it's configured with clojurebox.

Here are some specific questions I have:

  • How do I create a new clojure file in emacs and
  • Load an existing clojure file so the forms (values, functions) are available to the REPL
  • What is a good project structure? If I have more than one file what is the best way to proceed and
  • Does Programming Clojure http: //pragprog.com/titles/shcloj/programming-clojure answer these questions?
  • Is there a better environment than clojurebox? I've tried enclojure for netbeans and it's currently broken (won't create a project correctly). Netbeans 6.7.1 and enclojure 2009-08-25-release.
Was it helpful?

Solution

I can provide a partial answer to this. I hope to get up and running better with ClojureBox myself. I am familiar with emacs in general but not emacs with SLIME which is what ClojureBox provides. If you aren't comfortable with emacs itself I would suggest working with its own tutorial first to get the hang of it.

  • How do I create a new clojure file in emacs?

Use standard emacs file creation "C-x C-f" to open a new file. Chose a file name with the extension ".clj" and it will beauto-detected as a clojure file.

  • Load an existing clojure file so the forms (values, functions) are available to the REPL?

Use the load-file command (C-c C-l), note that you will have to have saved the file first (C-x C-s). It will now be available to the REPL.

Alternatively to just try out a block of code, highlight the region containing it and use (C-c C-r) to eval-region with SLIME (which is running your clojure REPL).

  • Does Programming Clojure http: //pragprog.com/titles/shcloj/programming-clojure answer these questions?

Not that I am aware of. It doesn't really deal with development environments.

For help using the book code with ClojureBox see this thread - http://groups.google.com/group/clojure/browse_thread/thread/b52ca7becceca16a

Also try the Clojure google group in general.

OTHER TIPS

I put together Clojure Box, but I don't know if a Clojure-specific Emacs tutorial other than the brief readme that comes with Clojure Box. The tips in Practical Common Lisp for traversing buffers and the REPL and loading code will apply.

For project layout check out the readme from technomancy's swank-clojure project on github. Clojure Box doesn't have this feature, but if you install swank-clojure on your own, you can follow the standard layout instructions under the Project section of the readme.

You may want to try Enclojure again since there was a release in November from Eric Thorsen's github account. The screencast of new features from the August 2009 build (http://www.vimeo.com/6270957) is pretty helpful too.

It is not a full tutorial, just a collection of useful keys. http://learnclojure.blogspot.com/2009/12/favourite-keys-for-emacs-and-slime.html

If you are at all familiar with Emacs clojurebox is great. Sets you up with everything needed to hit the ground running without fighting with your .emacs file.

Most file related work tends to be done calling out to java libraries so if you've learned the language well enough to understand using java (not hard) then just dig into the java docs for how to do that.

Biggest answer though is yes, Halloway's book does answer at least most of your questions, and more you will have as you learn the language.

Aside from the book I'd say the best resource is just hang out in IRC (#clojure on freenet) because the people in there have always been helpful any time I've hung out, and are quite willing to answer questions. This includes Rich and other core/contrib clojure commiters.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top