4 ms·
I definitely plan to learn some Prolog, but I don't know when. For now I plan on learning Datalog because it is used (or a variation on it is used) in Datomic.
by martinced 14y ago
I definitely plan to learn some Prolog, but I don't know when. For now I plan on learning Datalog because it is used (or a variation on it is used) in Datomic.
The relation between Prolog, Datalog and the "Datalog-like" query language used by Datomic is still not clear at all to me but hopefully soon the picture shall get clearer.
I know it's OT but that's what I really like about Clojure: Clojure taught me about Lisp (even if it's not a 100% pure Lisp), functional programming (even if it's not 100% purely functional), lazyness, monads (yup, really) and now it's probably going to introduce me, thanks to Datomic, to Datalog...
- jkbyc 14y agoDatalog is really a theoretical basis for declarative query languages. It amounts to a Horn-clause subset of predicate logic and in that it is similar to Prolog. One of the substantial differences is that Datalog doesn't allow functions in terms. That makes Datalog strictly less expressive but it also gives you a guarantee that a Datalog program will always terminate. In comparison, it is trivial to write even a simple Prolog program that does not terminate. Datalog is really almost just a special syntax for Horn-clauses; it is purely declarative. Prolog is much more than that in that it adds features like cuts, arithmetic, built-in functions, and everything else that's needed in a practical programming language. Also, a Prolog interpreter implements a sophisticated backward-chaining algorithm. So Prolog basically means backward-chaining. In comparison, I would say there is no default evaluation strategy for Datalog. You (resp. the interpreter) can use backward-chaining, forward-chaining, a combination of both (such as the magic-sets method) - the designer of the Datalog-based query language decides what's best.