Greg Rosenblatt will be giving a talk at Clojure/conj 2016. He will be talking about Barliman with Will Byrd.
Follow him on GitHub.
PurelyFunctional.tv: How did you get into relational programming?
Greg Rosenblatt: Serendipitously! Several years ago I dabbled with Prolog, but didn't quite get it. It seemed elegant and powerful for small examples, but it quickly became ugly for larger ones. The elegance didn't seem to scale. I didn't really understand why.
In March 2014, I ran across a talk on miniKanren, given by Dan Friedman and Will Byrd. This talk blew me away. The elegance they demonstrated seemed more robust than what I'd seen with Prolog, but again, I didn't really understand why.
About a year later, I decided to take a break from working professionally in order to make time for projects that were more research-oriented. One of my goals was to understand logic programming better, and miniKanren seemed the most approachable way. My preferred way of understanding a paradigm is to implement it, and luckily, a paper on the very concise microKanren was available as a guide. Really, this is all there is to it. From microKanren, there is then a straightforward path to miniKanren.
After implementing miniKanren in this way, I explored other variants that had been published, and started thinking about improvements and extensions. This was when I realized what enabled the elegance I had noticed, and what made it scale: pure logic programming!
Logic programming without resorting to extra-logical operators, i.e., pure logic programming, gives you relational programming. It's similar in spirit to the composability you get with purely functional programming. The examples possible in miniKanren are difficult to port to Prolog due to the latter's reliance on these extra-logical operators for taming an incomplete search.
Anyway, around this time, I emailed Will to discuss my ideas, which led to me joining the weekly miniKanren hangouts. A year later, this past May, he set up the Barliman project, and I started contributing in June. That's how my real adventure with relational programming started.
PF.tv: What is your talk about?
GR: We'll be demonstrating a prototype editor called Barliman and discussing its implementation in terms of a relational interpreter written in miniKanren. We'll also be showing off capabilities of relational interpreters beyond what we've implemented in Barliman so far.
Though it's not ready for serious use yet, Barliman already has some seemingly-magical powers. You write part of a program, provide some examples of how it should work, and Barliman can sometimes complete your program for you, or tell you that it's impossible to do so. Sometimes this works even if you don't write any of the program!
PF.tv: What do you hope people will take away from the talk?
GR: Relational interpreters have interesting capabilities. Some of what we show may seem magical, but it's not. Relational programming, in general, holds a lot of promise, and the basics are relatively accessible.
PF.tv: How do you see Barliman helping a person write more/better code?
GR: Eventually, I'd like to see it take on many of the uninteresting burdens of programming, acting as an assistant programmer. You work out the high level design and program structure, and it implements the tedious, error-prone parts for you. If you've already made mistakes, it might even point out and fix some bugs automatically. You'll also be able to ask questions about programs such as, "Which inputs will yield this output?"
PF.tv: What concepts do you recommend people be familiar with to maximize their experience with the talk?
GR: It should be possible to enjoy the talk without much prior knowledge, but there are some things you can become familiar with in advance to improve comprehension.
For those interested in doing logic programming in Clojure, core.logic is basically an extended implementation of miniKanren in Clojure. If you're familiar with this library, it should be easy to follow along.
We'll be showing examples involving Scheme and a Scheme-based miniKanren implementation, so some familiarity with these may help. There are some syntactic differences from Clojure, but the overall structure of Scheme programs should be familiar enough to follow if you already know Clojure.
PF.tv: What resources are available for people who want to study up before the talk?
I don't know what the best resources for learning core.logic are, but this seems like a good start.
PF.tv: Where can people follow you online?
GR: You can find some of my crazy experiments and half-baked ideas on GitHub.
From time to time I also write.
PF.tv: How can people help out with Barliman?
GR: If you're interested in Barliman, here are three ways you might help:
- Contribute ideas/code to the project directly on GitHub.
- Tell other people about the project to get them interested.
- Fund us! This would allow us to spend more time on the project.
PF.tv: Where do you see the state of IDEs in 10 years?
GR: Ideally there won't be any. Mankind will have achieved apotheosis, directly programming the world by thinking. Well, that's my dream at least.
If we somehow don't manage that, we should at least have IDEs that function as highly capable assistants, taking care of the tedious and error-prone aspects of programming so that you can focus on your goals. You might specify ideas with your preferred mix of logical declarations and examples while your assistant writes most of your programs for you. When confused, the assistant might pose additional examples, asking how they should work. You would be able to teach your assistant about particular domains, allowing it to become even more capable at the tasks you're interested in. Assistants could even meet with one another to share notes.
If we want to get more ambitious, assistants could become highly personalized to support more effective rapport. If they pay attention to the way you work, they could learn patterns about your style, things you tend to leave implicit, mistakes you tend to make...
PF.tv: If Barliman were a superhero, what superpower would it have?
GR: Barliman hasn't quite graduated from superhero school yet, but seems to have some talent with running backwards, blindfolded, teleporting through walls, in multiple universes simultaneously. Barliman has had some trouble focusing in school, though, and often gets lost in thoughts that will last until the end of time.
PF.tv: Thanks for the interview!
GR: Thank you for interviewing!