Chapter 6miniKanren

by Jack Moffitt

I’ve spent decades telling the computer how to do things. Logic programming offers a reprieve from this drudgery. While programming with logic, you describe the relations and constraints of your problem, and the computer figures out the solutions required.

I remember the first time I realized just how different logic programming is. At a conference, Dan Friedman and William Byrd were demoing a small language interpreter written in miniKanren. They first showed how it could evaluate simple numerical programs and get the correct answer. Then in an act of wizardry, they ran the same interpreter backward to produce programs that generated the answer 6.

Logic programming is the closest we may ever come to real ...

Get Seven More Languages in Seven Weeks now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.