Skip to content

Latest commit

 

History

History
37 lines (30 loc) · 1.17 KB

README.org

File metadata and controls

37 lines (30 loc) · 1.17 KB

shen-minikanren

A Shen implementation of miniKanren

shen-minikanren is a Shen implementation of miniKanren, an embedded DSL for logic programming. It was adapted with Will Byrd’s Scheme sources, which follow the definition of miniKanren given in the appendix of The Reasoned Schemer.

shen-minikanren integrates seamlessly into Shen’s type system. This form (example 1.54 in The Reasoned Schemer) type checks as:

(60+) (run* R
    (fresh (X Y)
	     (conde
	      ((=== split X)
	       (=== pea Y))
	      ((=== navy X) (=== bean Y))
	       (else mk-fail))
	      (=== [X Y] R)))
[[split pea] [navy bean]] : (list (walkable symbol))

The files that make up the implementation should be loaded into a Shen REPL in this order:

  • macros.shen (with tc -)
  • types.shen (with tc +)
  • minikanren.shen (with tc +)
  • prelude.shen (with tc +)

Examples are given in tests.shen and prelude.shen, all of which come from The Reasoned Schemer and Will Byrd’s sources.