Skip to content

Instantly share code, notes, and snippets.

@swannodette
Last active December 12, 2015 03:18
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save swannodette/4705272 to your computer and use it in GitHub Desktop.
Save swannodette/4705272 to your computer and use it in GitHub Desktop.
(unifier/unify
{:as '{?x (?y ?z)}
:constraints {'?z (fnc [n] (number? n))}
'(?x ?a) '(["foo" 9] [1 2 3]))
;; previously you couldn't name '(?y ?z)
(unifier/unify
{:constraints {'?z (fnc [n] (number? n)}}
'((?y ?z) ?a) '(["foo" 9] [1 2 3]))
;; if vector, we want a constraint that involve two or more vars
;; if set, we want to apply a constraint individually
(unifier/unify
{:constraints {'[?y ?z] (fnc [y z] ... #_(something about y & z) ...)
'#{?y ?z} (fnc [n] (number? n))}}
'((?y ?z) ?a) '(["foo" 9] [1 2 3]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment