Functions - sorokod/Clojure-Notes GitHub Wiki

Basic

(defn f1
	"Doco goes here"
	[x]
	(str "Param = " x))

Anon

(def data ["a" "bb" "ccc"])
(map count data)                            ; (1 2 3)

(map  (fn [word] (* 2 (count word)) ) data) ; (2 4 6)
; ## with anon syntax
(map #(          * 2 (count %))  data)      ; (2 4 6)