zzz6519003 / blog

My blog about coding
4 stars 1 forks source link

An Interview with David Nolen #95

Open zzz6519003 opened 7 years ago

zzz6519003 commented 7 years ago

The implementation of miniKanren we’ve been using is core.logic, written by David Nolen. David is the author of many great Clojure and JavaScript libraries and shares our fascination for logic programming.

Us: How did you get interested in logic programming, and what motivated you to create core.logic? David: I encountered logic programming for the first time in 2009. I had recently read a blog post by Jim Duey about logic programming—he had created a simple Clojure port of miniKanren and demonstrated that he could solve a classic logic puzzle (the Zebra/Einstein puzzle) in a declarative manner. I found this both sur- prising and intriguing and so I emailed him asking how it worked. He pointed to me to The Reasoned Schemer and I picked up a copy for travel reading on the way to the very first Clojure conference. For fun I decided to do a simple implementation myself. The Reasoned Schemer was short on implementation details and I went hunting for more information. Eventually I found William Byrd’s dissertation, which clarified quite a few points and guided my first working miniKanren implementation. Shortly thereafter Clojure introduced deftype, defrecord, and protocols and I sus- pected that a reasonably efficient implementation of miniKanren could be written. After four or five months of development I had an implementation of miniKanren that could solve the Zebra/Einstein puzzle nearly as quickly as SWI-Prolog. This was encouraging, and I immersed myself in logic and constraint logic programming literature and ported interesting ideas as I encountered them into what eventually became core.logic. Us: What kind of problems do you find logic programming best for solving? David: Any problem that benefits from a declarative solution where performance is not the utmost concern. Us: What can you do in core.logic that you can’t do in a language like Prolog? David: Modern Prologs are extremely powerful, flexible, and customizable. I think the main advantage of miniKanren over Prolog is the shallow embedding in a functional programming language. That is, miniKanren allows you to easily leverage the best paradigm for the problem at hand. Us: What other features would you like to have in core.logic? David: I would like integration with Clojure data structures to be greatly improved. I would also like to port all the finite domain functionality to ClojureScript, but this awaits a better official cross compilation story. There’s also a huge pile of perfor- mance enhancement ideas that I need to find time to assess and implement.