Tutorial by Examples

(defn x [a b] (* a b)) ;; public function => (x 3 2) ;; 6 => (x 0 9) ;; 0 (defn- y [a b] (+ a b)) ;; private function => (x (y 1 2) (y 2 3)) ;; 15
When applied on a map, returns a new map with new or updated key val pairs. It can be used to add new information in existing map. (def userData {:name "Bob" :userID 2 :country "US"}) (assoc userData :age 27) ;; { :name "Bob" :userID 2 :country "US&qu...
Comparisons are functions in clojure. What that means in (2>1) is (> 2 1) in clojure. Here are all the comparison operators in clojure. Greater Than (> 2 1) ;; true (> 1 2) ;; false Less Than (< 2 1) ;; false Greater Than or Equal To (>= 2 1) ;; true (>= 2 ...
This returns a map without the key-value pairs for the keys mentioned in the function argument. It can be used to remove information from existing map. (dissoc {:a 1 :b 2} :a) ;; {:b 2} It can also be used for dissocing multiple keys as: (dissoc {:a 1 :b 2 :c 3} :a :b) ;; {:c 3}

Page 1 of 1