Created
February 8, 2012 20:42
-
-
Save brehaut/1773494 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
;; original function | |
(defn assoc-meta [metable & kvs] | |
(with-meta metable (apply assoc (meta metable) kvs))) | |
;; rewritten with an explicit conjugation | |
(defn conjugate [translate untranslate f] | |
(comp untranslate f translate)) | |
(defn assoc-meta* [metable & kvs] | |
((conjugate meta | |
(partial with-meta metable) | |
#(apply assoc % kvs)) metable)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment