Events at RC usually start a few minutes past the hour, and it’s always more fun to spend the time in between with ice breaker questions. This week we had “What’s your favorite programming language mascot?”. I was going to go for Rust’s Ferris, but given this list, my vote has to go to the wonderfully-apt Docker whale (which I learned is called Moby Dock).
The topic this week at the functional programming study group was logic programming. We started with a quick demo of Prolog. The idea of declarative programming - tell the program what you want, rather than what to do - impressed our group; it certainly impressed Joe Armstrong.
What I was impressed by was the extensive use cases of Datalog. Datalog is a subset of Prolog, and since Alain Colmerauer created Prolog to solve problems in computational linguistics, it’s less of a surprise it’s extends nicely to ADTs. Recursive rules are easy to do, ditto graph algorithms. Program analysis involves reducing programs to a graph-like form so we also get this for free. Now there’s theorem-proving, CRDTs and incremental computing. If you haven’t noticed, all the links point to the excellent resource by Philip Zucker.
This excerpt on Frank McSherry's differential dataflow is a sign post for future reading. In particular, he notes how Datalog programs map very nicely onto incremental computation primitives.
Differential dataflow is a data-parallel programming framework designed to efficiently process large volumes of data and to quickly respond to arbitrary changes in input collections.
Thematically-related is Flix, a general-purpose programming language which is distinctive for its first-class Datalog support.
My take away from the week is, having spent a lot of time writing SQL, it would be nice to try out Datalog as a query language. Writing recursive queries is a lot more ergonomic in Datalog. What I also learned was SQL is closer to natural language by design, which perhaps explains hard-to-read SQL queries that correspond to simple logic programs.