Skip to content
Browse files

Adding Basic Clojure Project (May not run...)

  • Loading branch information...
1 parent c682d9b commit eac68144fbfcb7a2b14686608099a29f1674f85a @walterg2 walterg2 committed Jan 8, 2012
Showing with 75 additions and 0 deletions.
  1. +7 −0 clojure/.gitignore
  2. +39 −0 clojure/README.md
  3. +5 −0 clojure/project.clj
  4. +12 −0 clojure/src/simple.clj
  5. +12 −0 clojure/test/simple_test.clj
View
7 clojure/.gitignore
@@ -0,0 +1,7 @@
+classes/**/*
+classes/*
+lib/**/*
+lib/*
+.lein*
+*~
+**/*~
View
39 clojure/README.md
@@ -0,0 +1,39 @@
+Dead Simple Clojure Sample
+==========================
+
+The newest swank-clojure jar greately simplifies running a Clojure REPL in emacs, provided that you have
+a Clojure project set up.
+
+This is the simplest clojure project I could think of to try out the newest swank-clojure features.
+
+Requires:
+
+- Leiningen
+
+- A recent clojure-mode.el, with proper .emacs require statements.
+
+
+__These notes are very incomplete. I will fill in with links and detailed directions as I go.__
+
+You have to run `lein deps` in the project directory to install all needed dependancies.
+
+Once in Emacs `M-x clojure-jack-in` will get you a clojure REPL with classpath set to include all your project libs.
+
+You do _not_ need slime installed in your emacs for this to work.
+
+You can run the test suite(!!) by running `lein test` from the command line.
+
+From the clojure REPL in emacs you can run tests this way:
+
+ user> (use 'clojure.test)
+ nil
+ user> (use 'simple-test)
+ nil
+ user> (run-tests 'simple-test)
+
+ Testing simple-test
+
+ Ran 2 tests containing 5 assertions.
+ 0 failures, 0 errors.
+ {:type :summary, :pass 5, :test 2, :error 0, :fail 0}
+ user>
View
5 clojure/project.clj
@@ -0,0 +1,5 @@
+(defproject test-project "0.1.0-SNAPSHOT"
+ :description "FIXME: write this!"
+ :dependencies [[org.clojure/clojure "1.3.0"]]
+ )
+
View
12 clojure/src/simple.clj
@@ -0,0 +1,12 @@
+(ns simple )
+(defn hello
+ ([] "hello world!")
+ ([name] (str "hello " name "!")))
+
+(defn addem
+ "Add stuff"
+ ([] 0)
+ ([n] n)
+ ([n m] (+ n m))
+ ([n m & more] (reduce + (flatten (list n m more))))
+)
View
12 clojure/test/simple_test.clj
@@ -0,0 +1,12 @@
+(ns simple-test
+ (:use clojure.test)
+ (:use simple))
+
+(deftest simple-test
+ (is (= (hello) "hello world!"))
+ (is (= (hello "test") "hello test!")))
+
+(deftest addem-test
+ (is (= (addem) 0))
+ (is (= (addem 5) 5))
+ (is (= (addem 3 4) 7)))

0 comments on commit eac6814

Please sign in to comment.
Something went wrong with that request. Please try again.