monoid pattern
It strikes me that you can generate functions that implement the monoid pattern knowing only two things: the identity value and the 2-arg case. The other two cases (n-arg and 1-arg) can be calculated for you.
Your task is to write a function that takes the identity and the 2-arg case and returns a new function that implements the monoid pattern.
(defn monoid [id fn-2]
I should be able to call it like this:
(monoid 0 (fn [a b] (+ a b)))
and get an addition monoid out.