Skip to content

Instantly share code, notes, and snippets.

@tangrammer
Created June 6, 2014 01:33
Show Gist options
  • Select an option

  • Save tangrammer/16d701225b7451f6d30b to your computer and use it in GitHub Desktop.

Select an option

Save tangrammer/16d701225b7451f6d30b to your computer and use it in GitHub Desktop.
(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