Created
September 5, 2012 01:19
-
-
Save mattdeboard/3628843 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| (defmacro proxy-meta | |
| "This macro emits a function that can then be called with the appropriate | |
| args to proxy a given class, extending it to implement the `IObj' interface. | |
| " | |
| [class] | |
| `(fn make# | |
| [infile# & [moremeta#]] | |
| (let [metadata# (merge {:filename infile#} moremeta#)] | |
| (proxy [~class clojure.lang.IObj] [infile#] | |
| (withMeta [newmeta#] (make# infile# newmeta#)) | |
| (meta [] metadata#))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment