The short answer is that it's okay to use Clojure directly. You don't
need Leiningen.

If you are familiar with C programming, the difference between the
Clojure compiler and Leiningen is like the difference between GCC and
Make. Using the compiler directly is fine when you have only one file
of source code and aren't using any libraries. Using the compiler
directly is still possible with larger projects, but it can get
tedious. Then it is useful to have a build tool that makes it easier
to perform an operation on the project as a whole, rather than on
individual files.

With Leiningen, I type "lein new dragonslayer" and it creates a
directory called "dragonslayer" containing the basic outline of my new
project. In that directory, for example, there is a file called
"project.clj" that contains a list of all the libraries that I will be
using (it starts out listing just Clojure version 1.2 and Clojure
Contrib version 1.2). There is a "src" directory for my source code,
and the first empty source code file has been created for me. There is
a "test" directory for my tests, and the first simple test has been
created for me as an example. I can type "lein deps" to download all
of the libraries that my project needs. I can type "lein compile" to
compile the entire project. I can type "lein test" to run all of my
tests. I can type "lein repl" to open a repl which has access to all
of my code and all of the project's libraries. I can type "lein
uberjar" to create a JAR file that I can send to a friend who knows
nothing about programming, but who would like to double-click on my
file and run my program.

But you don't need any of that. You have one simple file, and it is
easy to compile that file directly.

When your projects get a little bigger, and you start to find the
compilation process tedious, then it is time to get a bigger build
tool, such as Leiningen. There are other options, such as Maven or
Ant, but Leiningen is my favorite. After learning how to use
Leiningen, I use it for all of my Clojure projects, even when I have
just one little file of source code.

I hope you are enjoying Clojure. Don't let all of this talk about
compiling distract you from the fun part: writing code.

Eric

On Wed, Oct 20, 2010 at 1:08 PM, ishkabible <j...@ehrlichks.net> wrote:
> thanks guys, im at school right now so i cant really try anything out,
> i think im just going to use a text editor with coljure via command
> line.. yes i was using repl, later i found that i could edit full
> files by simply saving a new file but could not compile them, i think
> i will try using command line to compile the test files i wrote with
> Coljure Box. before i download Leiningen could some one tell me what
> it's benefits are? i'm unclear what is different about it and the
> Coljure compiler.
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to