A pattern-matcher for αKanren -or- How to get into trouble with CPS macros

In this paper we present two implementations of the patternmatching macros λ and match for αKanren. The first implementation generates clean code, but our use of CPS-macros in its implementation leads to a problem in determining when a new binding needs to be introduced for a pattern variable. This problem stems from our delayed creation of bindings, where the comparison of identifiers is done first and then binders created in a later step. This may lead to an issue when macros generating λ or match expressions may appear to break hygiene because the CPS-macros incorrectly identify two identifiers as being the same. The second implementation addresses these concerns by using more traditional macros, generating bindings as new variables are encountered.