Last active
August 29, 2015 14:20
-
-
Save michaelsbradleyjr/6f7dc255b6b9cef60384 to your computer and use it in GitHub Desktop.
This file contains 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 qc | |
[op] | |
(fn [coll] | |
(if (not= (count coll) 2) | |
(throw (IllegalArgumentException. "coll must have length 2."))) | |
(if (odd? (first coll)) | |
(throw (IllegalArgumentException. "first elem must be even."))) | |
(if (even? (second coll)) | |
(throw (IllegalArgumentException. "second elem must be odd."))) | |
(apply op coll))) | |
(def f1 (qc +)) | |
(def f2 (qc -)) | |
(def f3 (qc /)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment