My first steps in learning Clojure and setting things up.
Start with Leiningen
Leiningen is like Gemfile and Rakefile in Ruby, plus much more.
(or use your preferred package manager)
Start a new project
By default a command-line app is generated. You can get a different starting point by specifying a template, for example Figwheel for ClojureScript, Play for dekstop and mobile games, or Luminus for websites.
A commandline app is packaged as an uberjar, that is a jar file which includes all it’s dependencies.
You can build the uberjar:
and run it using
java -jar playground-0.1.0-standalone.jar.
The REPL (Read Eval Print Loop), like Irb in Ruby, can be started with
In the REPL we can requie and run our newly created app:
In the source
playground.core is a namespace and
-main is a function. The
-main function is used as an entry point for the uberjar, it is passed the commandline arguments as its arguments.
The REPL is the best place to start experimenting with Clojure syntax.
This is just here for compleness, I don’t intend to write any tests for quite a while.
For more detailed information about Lein see the leiningen tutorial.