Posts

Showing posts from September, 2011

Clojure and maven

Image
I had started about learning clojure and though the REPL interpreter seems to be the standard way of starting learning, I wanted to do it in a more Test driven method using maven. So I created a source and test directory and went about writing a simple learn.clj and a simple testlearn.clj. Took some time to figure things out and make the tests work Here is the directory structure


 (Learn.clj dir structure \NetBeans2\ClojureLearn2\src\main\clojure\my\clojure\learn.clj)

(ns my.clojure.learn
 (:gen-class))


(defn main  [args]
  (println  "A red apple tree" )
   (println (def x(str "Hello " args "!")) )
   x
 )


(defn add [x y]
    (+ x y)
)


( defn workingwithlist []
  (println "In the function workingwithlist")
  (def listx (list 1 (add 1 1) 3 4  ))
   (doseq [item listx]
   (println item))
     listx
  )

 (TestLern.clj dir structure \NetBeans2\ClojureLearn2\src\test\clojure\my\clojure\Testlearn.clj)


(ns my.clojure.Testlearn
(:use my.clojure.learn)
(:use clojure.test)
  …