ambKanren: miniKanren Based on amb
ambKanren is a miniKanren in which backtracking is not implemented by a stream of answers but delegated to the ambiguous operator amb of the typed/amb library. A goal is an ordinary function from substitutions to substitutions (from states to states, in microKanren); when a goal fails it calls (amb), and when it has several answers it chooses one of them with amb. The search over all choices is performed by in-amb/do, which run uses to collect answers.
The package provides one module for each language it implements:
typed/microKanren/amb: microKanren (Hemann and Friedman, 2013), the minimal functional core.
typed/miniKanren/amb/trs1: the language of the first edition of The Reasoned Schemer (Friedman, Byrd, and Kiselyov, MIT Press, 2005).
typed/miniKanren/amb/trs2: the language of the second edition (Friedman, Byrd, Kiselyov, and Hemann, MIT Press, 2018).