Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
A practical, hands-on introduction into programming Clojure
Clojure Shell
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
src
.gitignore
README.md
TODO.md
prepare_all.sh
project.clj
project.clj.ultimate-todo
todo-webapp.md

README.md

Iterate Clojure Introduction Workshop

A practical, hands-on introduction into programming Clojure, the best JVM language ever :-)

Clojure is a modern Lisp language (Why Lisp?) targetting JVM and browsers, designed for concurrency, simplicity, and productivity. Clojure us especially popular for interactive web development and data analysis.

The workshops starts with a brief overview of why you might want to consider Clojure, then introduces the elementary building blocks necessary to build something useful in a series of exercises, and concludes with the construction of a simple web application (if time permits).

Preparation before the workshop

To get this repository using git:

bash$ git clone git://github.com/iterate/iterate-clojure-workshop12.git; cd iterate-clojure-workshop12

Alternatively, download it as ZIP and unpack it somewhere and enter it.

To get all the tools you will need ready, execute the attached script (you might want to check/modify it if you already have Leiningen or Catnip installed):

bash$ source prepare_all.sh
# Note: If downloading of dependencies gets stucked then stop it via Control-C and run './lein' manually

It will

  • Download and initialize the latest Leiningen 2 (Clojure build tool)
  • Leiningen will download latest Clojure
  • It will download and start Catnip, the leightweight in-browser Clojure IDE;
    • Catnip should start a browser, if it doesn't, open the URL printed (Catnip is optimized for Chrome so use that)
    • In Catnip, type f.ex. (println "hello") and press Control-E to evaluate it to see that all is working
    • Press Control-C in the console to stop Catnip

Ponder your reasons why Clojure might be interesting

One common complain was that we jumped into Clojure without really communication its value. While we would live to do that, we believe our time together is more efficiently spent conding and you can well do it yourself. Respecting your time constraints, have a look at the following, priority-ordered motivtion treasures:

  1. Land of Lisp (Clojure primarily is a lisp) - scroll down a little; click on guild names for more info
  2. Clojure Philosophy at the The Joy of Clojure page at Manning
  3. Paul Graham's legendary essay Beating the Averages
  4. The great talk Simple Made Easy by Rich Hickey

You may also want to check out the list of good reasons why Clojure by Leo Polovets at Quora.

Development Environments

Recommended:

  • Catnip (installed by the script; also supports the Markdown format used by this document)
    • Why Catnip? It is simple to install, sufficient, written in Clojure, and in Norway
    • Tip: Exceptionally you might need to force the repl to forget a function; execute (ns-unmap *ns* 'name-of-the-test) in the REPL

Partially supported:

Tip: Make Catnip available by default

We have added the Catnip Leiningen plugin as an explicit dependency of this project. You can also make it available to all project by adding it to your ~/.lein/profiles.clj:

{:user {:plugins [
    [lein-catnip "0.5.1"]
    ]
}}

(Verify the latest version at Clojars.)

Trying to run lein edit without having Catnip in profiles or the project.clj will result in the failure "'edit' is not a task."

Ready, steady, go!

Congratulations! You are now ready for the workshop.

The workshop

The workshop consists of:

  1. Brief introduction
  2. Clojure-mini tutorial: a "minimal" subset of Clojure with fall-back to Java enabling you to read Clojure source codes and write interesting stuff; accompanied by hands-on tasks
  3. If time: building a todo webapp using Noir (see todo-webapp.md)

Clojure reference documentation

The tasks

You should be able to finish each task in a short time, using the Clojure taught so far and Java. You can use Catnip for them - simply run lein edit in this directory.

Don't read the *.solutions.clj files and further tasks ahead of time since revealing the solution would spoil the fun.

Tip: Don't waste time, whenever lost, unsure how to progress, or experiencing problems, ask the instructors for assistence.

Next steps

  • Watch Chas Emerick's excellent screencast Starting Clojure. It is a great example of Clojure development in general and, in particular, interactive Clojure web development without restarts, with live code changes and direct access to the running app via REPL. It also makes a good job of introducing the Eclipse Clojure plugin Counterclockwise and the popular web framework Compojure with the template engine Enlive and HTTP abstraction Ring. Highly recommended!
  • Start solving the programming tasks at 4clojure.com, from elementary to hard, while following some of the top 100 users so that you can compare your solution to theirs and thus learn from them
  • Read the excellent Joy of Clojure that introduces not only the language but also, more importantly, the philosophy behind it and the correct way of doing things (recommended for people that already have some experience with Clojure; complete beginners should check out Stuart Halloway's Programming Clojure, 2nd ed. (not the same as Chas Emerick's Clojure Programming though it might be a good choice too))
  • Explore clojure-doc.org

Produced by Ivar, Jakub, Lars @ Iterate 2012

Something went wrong with that request. Please try again.