Hacker News new | ask | show | jobs
by trurl 2947 days ago
Yes, I'm well aware of tabling, which is why I said "naïve Prolog implementation". I'm also aware of using magic sets and demand transformations to allow writing Prolog-like relations in Datalog.

I also work on an industrial strength Datalog implementation and I can tell you unequivocally there is very little relationship with how a real Datalog engine is implemented and a Prolog implementation.

And no, learning Prolog will not help you learn Datalog. Unless you're going to always us tabling or demand transformations, the difference in evaluation model requires writing in a very different style.

1 comments

Yes, such implementation differences definitely exist!

Whether one emphasizes the differences or commonalities of Prolog and Datalog may also depend on commercial interests: For vendors of Datalog systems, it may be advantageous to stress the differences. For Prolog vendors, it may conversely be advantageous to stress their commonalities.

Personally, I learned Prolog before Datalog, and it was easy for me to learn Datalog because I was already familiar with Prolog. The reason may be that I try to write as declaratively as possible when programming in Prolog, and that carried over well to Datalog too. More recently, I have also used tabling in many Prolog programs, and often obtained very general programs with good termination properties, similar to Datalog definitions.