Created
January 23, 2009 14:27
-
-
Save robertpfeiffer/51026 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn monoid? | |
([op zero example-vals check] | |
(and (= zero (op zero zero)) | |
(every? (fn [val] (= val (op zero val) (op val zero))) | |
example-vals) | |
(closure-under? op example-vals check) | |
(a-associative? op (conj example-vals zero))))) | |
(monoid? clojure.set/union #{} [#{:d :g} #{2 3}] set?) | |
(monoid? concat nil [[:a :b] [1 2 3][""]'(a b c d e)] seq?) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment