Skip to content

Instantly share code, notes, and snippets.

@michaelsbradleyjr michaelsbradleyjr/qc.clj
Last active Aug 29, 2015

Embed
What would you like to do?
(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
You can’t perform that action at this time.