I’m not a Ruby programmer, but from what I have heard I would enjoy programming in it. If you have been programming in Ruby or using maven, you have probably had exposure to new build environments like cake or leiningen; I did not have prior experience. But, I digress. First let’s get to what I found out about dynamic tags and Clojure 1.3.0.
This post on github talks about dynamic binding and warnings that come out of the compile step. So for now, my projects and even my CodeLesson’s Intro To Clojure course will be at 1.2.1, unless absolutely necessary. This post was very helpful.
Yesterday, I was working on my first CodeLesson assignment and felt even more like a knucklehead than usual. That is because there were multiple build problems, and I had not written any Clojure code in quite a while. I was getting the 1.3 dynamic def warnings, and also could not build a main. Here is what I learned.
To build an executable, you need (:gen-class) in the source file. As to file and directory names, it is all about name spaces mentioned in the source and project .clj files and the file name implementing the name.
At least for Clojure 1.1.2, you cannot have mr1/project.clj, mr1/src/mr1.clj with namespace mr1 and main mr1. The build just won’t work. So, here are my project.clj and mr1_mr1.clj files in directories mr1 and mr1/src respectively, and cake works just fine:
(defproject mr1-mr1 "0.0.1-SNAPSHOT" :description "TODO: add summary of your project" :dependencies [[org.clojure/clojure "1.2.1"] [org.clojure/tools.cli "0.1.0"]] :main mr1-mr1)
(ns mr1-mr1 (:gen-class) (:use [clojure.string :only [split]] [clojure.string :only [join]]))