Created
June 6, 2014 01:33
-
-
Save tangrammer/16d701225b7451f6d30b 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
| (ns cylon.test) | |
| (defprotocol Mine | |
| (me [_])) | |
| (defrecord TheMine [body condi place] | |
| Mine | |
| (me [this] | |
| (condi (get-in body place)) | |
| )) | |
| (defmacro the-condp [& o] | |
| `(fn [o#] (condp = o# ~@o))) | |
| (->TheMine | |
| {:body {:message false}} | |
| (the-condp true [:ey :tuay] false [:aaa :yyy]) | |
| [:body :message]) | |
| (me (map->TheMine {:body {:body {:message false}} | |
| :condi (the-condp true [:ey :tuay] false [:aaa :yyy]) | |
| :place [:body :message]})) | |
| (defmacro other [body place & e] | |
| `(->TheMine | |
| ~body | |
| (the-condp ~@e) | |
| ~place)) | |
| (me (other | |
| {:body {:message {:path true}}} | |
| [:body :message :path] | |
| true [:ey :tuay :true!!!] | |
| false [:aaa :yyy :false!!])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment