Skip to content

Instantly share code, notes, and snippets.

@brehaut
Created February 8, 2012 20:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brehaut/1773494 to your computer and use it in GitHub Desktop.
Save brehaut/1773494 to your computer and use it in GitHub Desktop.
;; 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