DarkMatter in Cyberspace
  • Home
  • Categories
  • Tags
  • Archives

Run Clojure Script Portable


Download leiningen script to ~/.lein, make it executable with chmod 755 lein. Add ~/.lein into $PATH, and run lein repl. This will download clojure jar into folder ~/.m2/repository/org/clojure/clojure/1.8.0.

Add an alias into your ~/.bash_aliases: alias clj='java -cp ~/.m2/repository/org/clojure/clojure/1.8.0/clojure-1.8.0.jar clojure.main'.

So you can start a clojure repl with clj (which is much faster than lein repl).

To run a script, add script file name and arguments after clj. For example:

cat << EOF > hi.clj
(println "hello world")
EOF
clj hi.clj

cat << EOF > hello.clj
(doseq [name *command-line-args*] (println (#(str "Hello, " % "!") name)))
EOF
clj hello.clj Leo Chad

P.S.: you can also download clojure jar from its website directly.



Published

Nov 22, 2013

Last Updated

Nov 22, 2013

Category

Tech

Tags

  • clojure 26
  • portable 1
  • script 4

Contact

  • Powered by Pelican. Theme: Elegant by Talha Mansoor