Created
June 6, 2016 12:10
-
-
Save bcambel/0d8a26c5a9a822a9828d1bebecefae7f 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
| (def transform-keys (keys transformators)) | |
| (defmacro defvariant [name] | |
| ` (defmulti ~name | |
| (fn [structure#] | |
| (:f structure#)))) | |
| (defmacro defcase [name field ] | |
| `(defmethod ~name ~field [structure#] | |
| ((~field transformators) (:data structure#)))) | |
| (defvariant transformer-func) | |
| (mapv | |
| (fn[field] | |
| (defcase transformer-func field)) transform-keys) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment