Skip to content

Instantly share code, notes, and snippets.

@rhz
Created February 24, 2011 18:59
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 rhz/842663 to your computer and use it in GitHub Desktop.
Save rhz/842663 to your computer and use it in GitHub Desktop.
(defprotocol AKappaExpression
"Kappa expression"
(agents [e] "get all agents in this expression")
(complexes [e] "get all complexes in this expression")
(subexpr [e ids] "get a subexpression for the given agent ids")
(merge [e1 e2] "merge two expressions")
(count-automorphisms [e] "count the number of automorphisms")
(expression? [e] "predicate for AKappaExpression")
(match [e1 e2] "returns a map from agent ids in e1 to their matching agent ids in e2")
;; should this methods be part of AKappaAgent?
(complex [e id] "get the complex to which agent id belongs")
(new-id [e id] "give a new id to agent id"))
(deftype Expression [as cs]
AKappaExpression
(agents [_] as)
(complexes [_] cs)
(subexpr [e ids] (zipmap ids (map e ids)))
(merge [e1 e2] (...))
(count-automorphisms [e] ...)
(expression? [_] true)
(match [e1 e2] (match-expr e1 e2)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment