[go: up one dir, main page]

Skip to content

mthom/shen-minikanren

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

An embedding of miniKanren in Shen.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages