Ambrose Bonnaire-Sergeant is currently an undergraduate student at the University of Western Australia and an accomplished musician. As an undergrad (on about the Callovian age) I struggled to decode Kant, pointers, and power chords. By contrast, Ambrose is a contributer to the core.logic and core.match libraries, the creator of the Logic Starter Kit, and the presenter of a well-received talk at the 2011 Clojure Conj. I shudder to think what he might produce should he find some free time.
How did you discover Clojure?
Last year, in my third year of undergraduate studies, and I took a unit on alternative programming paradigms. It introduced me to functional programming (via F#) and some logic programming with Prolog. This inspired me to check out other functional programming languages, which led me to the books On Lisp and SICP.
The first time I'd heard of Clojure was reading "Seven Languages in Seven Weeks". After reading a brief description I flicked straight to the Clojure chapter and was blown away. I could leverage existing Java knowledge while learning functional programming in a clean and sane language.
And it was Lisp!
How did you become interested in and ultimately involved in core.logic and core.match?
David Nolen developed core.logic as a faithful port of miniKanren, an embedded logic language in Scheme. The idea of bringing logic programming to Clojure sparked my initial interest in core.logic. I picked up The Reasoned Schemer and had a blast following along with core.logic.
David would be the first to admit that core.logic is a faithful port, but the amount of time and effort needed to deeply understand miniKanren is enormous. As he puts it, he's studied 300 lines of Scheme for over 12 months. His awesome efforts inspired me to contribute, so I found some little jobs around the code base and cleaned up a little documentation. core.match, another of David's projects, is a pattern matching library with the ultimate goal of (Efficient) Predicate Dispatch.
Clojure multimethods are "open" in that you can add dispatch methods at any time. The dispatch function of a multimethod, however, is hardwired ("closed"). Predicate Dispatch does away with a dispatch function by ordering dispatch methods according to subsumption and other strategies, making it a truly "open" system.
I was drawn to David's ambition for Predicate Dispatch as a viable programming tool, and his ideas for incorporating core.logic into its implementation. David has since had many interesting ideas for achieving efficiency, which he outlined in his Clojure Conj talk last month. I have been involved in some preparatory groundwork for Predicate Dispatch, helping create an extensible pattern matching library we hope to use as a basis for Predicate Dispatch.
What are the goals of the Logic Starter project?
When I was first getting interested in core.logic, the best way to get started was The Reasoned Schemer. This is still the case, but there weren't any online resources giving a compelling introduction to the ideas of core.logic.
Logic Starter hopes to fill that void. The main tutorial plays around with a Type Checker for the Simply Typed Lambda Calculus and eventually introduces most of the core.logic primitives. One reason Relational Programming is entertaining is the same code can be used in many different ways. Soon, you discover the same Type Checker can be used as a Type Inferencer. And it gets better!
The next step for Logic Starter is to keep up with David, who is porting cKanren to core.logic. cKanren is an extension of miniKanren that provides Constraint Logic Programming, a paradigm that is quite useful in many real-world contexts. Ultimately, I hope Logic Starter convinces people to buy The Reasoned Schemer and start their own wonderful journey with Logic Programming.
If you could add something to Clojure, what would it be and why?
The ClojureScript compiler has opened many exciting possibilities for the next generation of Clojure tooling. Rich Hickey has pointed out the compiler's analysis phase could potentially be used for complex code analysis or other tools.
One area that excites me is adding an ad-hoc type checker to Clojure.
Clojure is a dynamic language, so adding optional static typing needs to be considered carefully. Not everything can be type checked because some portions of our code could be untyped. For example, importing typed code from untyped code should add contracts to preserve the type invariants. Also, conversely, importing untyped code from typed code requires extra type annotations from the programmer.
Typed Racket has some exciting innovations and comes with with a treasure trove of papers explaining its implementation and rationale. The line between dynamic and static languages is getting thinner, and languages like Typed Racket are leading the way. To this end, I've started the Typed Clojure project, which will (initially) be an attempt to port Typed Racket to Clojure. I expect to find some ideas that fit, and some that don't. For example, Multimethods and Protocols play a large role in Clojure, where Racket might use more straightforward means like a conditional on type predicates. Typed Racket is very particular about its goals, but it has introduced important strategies for typing dynamically typed code.
Do you play any instruments?
As my girlfriend puts it, I'm either thinking about Computers or Music. I'm mainly a classical clarinetist, but I also sing in choirs and bang around on guitars. Making music with others is a great joy. I have been in several local orchestras and in the UWA Winthrop Singers. I've just returned from recording a CD of choral music over the weekend with the Winthrops, our second in two years. We also toured China last year and performed at the International Society for Music Education World Conference in Beijing.
Bands that incorporate electronics into music making like Radiohead and Portishead are great inspirations of mine. While I haven't made time to play with it, Sam Aaron's brilliant Overtone project could be a fascinating way to explore this style myself by combining my previous musical training with my Clojure experience. This really excites me!
Perhaps core.logic could be used to produce potential harmonic analysis' of a piece, which could influence the nuances of an automated performance. Schenkerian analysis comes to mind. I'd have to think about that one...
What are your plans for the future?
I've got one year left in my Computer Science Undergraduate degree at UWA. I have a final year honours research project and I'm planning to incorporate Typed Clojure into my study. After that, I'd love to spend some time at some American Universities like Indiana, Carnegie Mellon and Northeastern University.
I am eternally grateful for those who donated to make my Clojure Conj trip happen last month. Apart from the Conj itself, some other opportunities arose. I managed to spend a week at Carnegie Mellon, and was completely bombarded with type theory and theorem provers. That was awesome.
I also was privileged to meet Dan Friedman and William Byrd, two of the people responsible for miniKanren, cKanren and The Reasoned Schemer. I'm looking forward to seeing them at Indiana University when I get the chance to visit.