10. Functions
+ inplace functions
#(say %1)
+ anonymous functions
(fn [x y] (+ x y))
+ named-functions
(def add2 (fn [x y] (+ x y)))
(defn add2 (+ x y))
(defn addN
([] 0) ([x] x) ([x y] (+ x y)))) ;; function arity
11. Seq(uence)
“It is better to have 100 functions operate on
one data structure than to have 10 function
operate on 10 data structures”,
Alan J. Perlis
32. Installing lein
1. Download the lein script
(or on Windows lein.bat)
2. Place it on your $PATH
(eg. ~/bin)
3. Set it to be executable
(chmod a+x ~/bin/lein)
40. Books
1. “Clojure Programming” by Chas Emerick
http://shop.oreilly.com/product/0636920013754.do
2. “Joy of Clojure”, by Micheal Fogus & Chris Houser
http://shop.oreilly.com/product/0636920013754.do
3. Clojure Cookbook, by community
http://clojure-cookbook.com/