Reading Camlp4, part 11: syntax extensions
In this final (?) post in my series on Camlp4, I want at last to cover syntax extensions. A nontrivial syntax extension involves almost all the topics we have previously covered, so it seems fitting...
View ArticleThree uses for a binary heap
Lately I have been interviewing for jobs, so doing a lot of whiteboard programming, and binary heaps keep arising in the solutions to these interview problems. There is nothing new or remarkable about...
View ArticleLogic programming in Scala, part 1
I got a new job where I am hacking some Scala. I thought I would learn something by translating some functional code into Scala, and a friend had recently pointed me to Kiselyov et al.’s Backtracking,...
View ArticleLogic programming in Scala, part 2: backtracking
In the previous post we saw how to write computations in a logic monad, where a “value” is a choice among alternatives, and operating on a value means operating on all the alternatives.Our first...
View ArticleLogic programming in Scala, part 3: unification and state
In this post I want to build on the backtracking logic monad we covered last time by adding unification, yielding an embedded DSL for Prolog-style logic programming.PrologHere is a small Prolog...
View Article