21

I want to use Clojure's Core.logic. However, I want to also understand how it works. Is there a concise explanation of it somewhere? (Like implementing a metacircular evaluator?)

Thanks!

Michel Schinz
  • 458
  • 5
  • 6

2 Answers2

20

core.logic is an implementation of miniKanren - originally written and designed in Scheme by Dan Friedman, William Byrd, Oleg Kiselyov and others. It is an attempt to embed Prolog-style relational programming within Lisp.

If you want to understand how it works you'll need to read the first three chapters of William Byrd's dissertation: https://scholarworks.iu.edu/dspace/bitstream/handle/2022/8777/Byrd_indiana_0093A_10344.pdf?sequence=1

The Reasoned Schemer also covers the unifier in detail. However the much more subtle goal portion of miniKanren isn't given a comprehensive treatment - you'll need to look at Byrd's dissertation for that.

Even then, as with meta-circular interpreters - many insights cannot be gained without trying to implement the system yourself in a variety of programming languages.

dnolen
  • 18,496
  • 4
  • 62
  • 71
  • 3
    I'd add: https://github.com/clojure/core.logic/wiki/A-Core.logic-Primer as well as the advice to look into programming in Prolog (more examples, similar ideas, though less versatile than miniKanren). – Isaac May 01 '12 at 22:42
  • Your link to Byrd's thesis is broken. :-( – J D Aug 21 '12 at 21:07
2

You can also see David's talk on core.logic from the Strange Loop 2012.

And for very light introduction to the topic see also: sokuza-kanren

mnicky
  • 1,308
  • 11
  • 24