;; partial takes a function and one or more arguments ;; and returns a function with those arguments fixed ;; in this case the multiplication function * which can take n-arguments (def times-two (partial * 2)) (times-two 3) => 6 ;; comp applies functions from right-to-left ;; mathematically: f(g(x)) = f o g (def trim-and-up (comp str/upper-case str/trim)) (trim-and-up " don't panic! ") => "DON'T PANIC!" ;; juxt returns a function which creates a sequence by applying each function to its arguments ((juxt first rest) [1 2 3]) => [1 (2 3)] ;; create pairs of a string and its length (map (juxt identity count) ["length" "of" "each" "string"]) => (["length" 6] ["of" 2] ["each" 4] ["string" 6]) ;; sort it by length: second takes the second element of the list above (sort-by second (map (juxt identity count) ["length" "of" "each" "string"])) => (["of" 2] ["each" 4] ["length" 6] ["string" 6])