ClojerksApril 18th, 2012
Cosmin Stejerean
Wednesday, April 18, 12
Getting startedwith Clojure
Wednesday, April 18, 12
Start at the REPL
Wednesday, April 18, 12
iclojure.comcurl -O -L http://clk.tc/iclojure
chmod +x iclojure
sudo mv iclojure /usr/local/bin
Wednesday, April 18, 12
$ iclojureuser[1]:(println “hello world”)hello world
user[2]:(doc println)
user[3]:(source println)
Wednesday, April 18, 12
Clojure Projects
Wednesday, April 18, 12
leiningencurl -O -L http://clk.tc/lein
chmod +x lein
sudo mv lein /usr/local/bin
Wednesday, April 18, 12
lein new clojerkscd clojers
Create project
Wednesday, April 18, 12
(ns clojerks.core)
(defn greet [name] (str "Hello" name))
(defn -main [] (println (greet "Clojerks!"))
src/clojerks/core.clj
Wednesday, April 18, 12
Run project
lein run -m clojerks.core
Wednesday, April 18, 12
Editing Clojure
Wednesday, April 18, 12
Emacs 24
clojure-mode
Wednesday, April 18, 12
Vim
nailgun
slimv
Wednesday, April 18, 12
IntelliJ
La Clojure
Wednesday, April 18, 12
Eclipse
Counterclockwise
Wednesday, April 18, 12
Netbeans
Enclojure
Wednesday, April 18, 12
Textmate
https://github.com/swannodette/textmate-clojure
Wednesday, April 18, 12
Sublime Text
https://github.com/wuub/SublimeREPL
Wednesday, April 18, 12
Emacs
Wednesday, April 18, 12
Emacs on OS Xbrew install emacs --HEAD
or
http://emacsformacosx.com/
Wednesday, April 18, 12
Marmalade
(require 'package)(add-to-list 'package-archives '("marmalade" . "http://marmalade-repo.org/packages/") t)(package-initialize)
~/.emacs.d/init.el:
Wednesday, April 18, 12
Clojure Mode
M-x package-install
clojure-mode
Wednesday, April 18, 12
Clojure Swank
lein plugin install lein-swank “1.4.4”
Wednesday, April 18, 12
Launch REPL
M-x clojure-jack-in
Wednesday, April 18, 12
Shortcuts
http://clk.tc/emacs-slime-keys
Wednesday, April 18, 12
Testing
Wednesday, April 18, 12
Run tests
lein test
Wednesday, April 18, 12
Write a test
(deftest test-greet (is (= "Hello Cosmin" (greet "Cosmin"))))
Wednesday, April 18, 12
clojure-test-mode
run tests => C-c ,run one test => C-c M-,
Wednesday, April 18, 12
Further considerations
Wednesday, April 18, 12
Lein IClojure
lein plugin install iclojure 1.0iclojure
static code analyzerwrite more idiomatic clojure
Wednesday, April 18, 12
JVM Options
in project.clj
:jvm-opts ["-Xmx1g" "-server"]
Wednesday, April 18, 12
Kibit
lein plugin install jonase/kibit 0.0.3lein kibit
static code analyzerwrite more idiomatic clojure
Wednesday, April 18, 12
Pomegranate
https://github.com/cemerick/pomegranate
add deps directly from the repl
Wednesday, April 18, 12
Thanks!
Wednesday, April 18, 12
Top Related