Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding Basic Clojure Project (May not run...)
- Loading branch information
Showing
5 changed files
with
75 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,7 @@ | |||
classes/**/* | |||
classes/* | |||
lib/**/* | |||
lib/* | |||
.lein* | |||
*~ | |||
**/*~ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,5 @@ | |||
(defproject test-project "0.1.0-SNAPSHOT" | |||
:description "FIXME: write this!" | |||
:dependencies [[org.clojure/clojure "1.3.0"]] | |||
) | |||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -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)))) | |||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -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))) |