Skip to content

Instantly share code, notes, and snippets.

@thheller
Created July 5, 2013 12:24
Show Gist options
  • Save thheller/5934194 to your computer and use it in GitHub Desktop.
Save thheller/5934194 to your computer and use it in GitHub Desktop.
(defn cond-transform [x & pairs]
(reduce (fn [x [test-fn transform-fn]]
(if (test-fn x)
(transform-fn x)
x))
x
pairs))
;; example
(cond-transform x
[test1 transform1]
[test2 transform2]
[test3 transform3])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment