Skip to content
An embedding of miniKanren in Shen.
Shen
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
LICENSE
README.org
macros.shen
minikanren.shen
prelude.shen
tests.shen
types.shen

README.org

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.

You can’t perform that action at this time.