Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I used Datalog a good deal in grad school (CS). It was frustrating at first, but once I figured it out, I liked it a lot.

If you've never tried a declarative programming language, you should give Datalog a try.



+1 to Datalog -- it is fantastic for static analysis in particular! There are a bunch of papers from Yannis Smaragdakis' group on this; I built my thesis work on top of their system Doop [1] which is a whole-program points-to analysis written completely in Datalog.

In general it's very nice to be able to prototype queries/inference rules quickly and then tweak clause ordering, etc for performance later if needed.

[1] https://bitbucket.org/yanniss/doop/src/master/


Probably worth mentioning for those interested in Datalog that there's actually a growing selection of databases for Clojure that use Datalog as their query language. These Clojure variants of Datalog (they model triples as Clojure data structures) are basically becoming as ubiquitous in Clojure as SQL is elsewhere.

I have documented them here: https://github.com/simongray/clojure-graph-resources#datalog


If I may hijack the Clojure reference, how does Clojure’s core/logic compare to Prolog? Do they broadly fit in the same problem space?


I think core.logic is basically just a Clojure implementation of miniKanren. I'm not too familiar with logic programming myself, but my impression is that miniKanren, core.logic, and Prolog all use basically the same algorithm, operate on the same type of data, and try to solve the same set of problems. The advantages/disadvantages are probably external to the core problem space, e.g. do you prefer an embedded DSL better to a full-blown logic programming language and so on.

I'm a hardcore Clojure advocate (it's a fantastic programming language with a great ecosystem of libraries), but there's no doubt that the amount of resources available for learning the API of core.logic is less than what's available for Prolog. If the objective is to learn logic programming from the available resources, Prolog is probably the better option.


TerminusDB, Crux and Grakn are other databases that use Datalog variants. Becoming a big thing.


You might like Flix then: first-class datalog constraints https://flix.dev/




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: