What are the 21st century Prolog tips, tricks, techniques?

Recently I spend sometime with someone who’d been programming in Prolog, exclusively, for 2 decades. We spoke of new Prolog tricks that he used in 2019 that were not widely known in 2000. e.g. He’s been working on grammar-based fuzzing for test generation… which sounds like a natural application for Prolog.

So I’m wondering what else is lighting-up Prolog? According, I want to ask three questions for experienced Prolog programmers:

  • Q1: What keeps them in that language?
  • Q2: Anyone got pointers to new generation Prolog applications?
  • Q3: Anyone got some reference to new generation Prolog techniques? FYI: I know most of the Bratko/ Sterling/ O’Keith/ Clocksin&Mellish methods.

If you double post a question, please note it in the question. :smiley:

StackOverflow: advanced prolog tricks for 2019? [closed]

I write a logic programming tech blog that includes posts on semantics, best practices, and design patterns:


I am not an experienced Prolog programmer, but I am full of opinions and caffeine, so there it goes. I will re-phrase your questions so that it is easier to say what I have to say.

(My job title is “senior software developer”, which might not be completely true, but still, I do write code every day, mostly not in Prolog. So my opinions are of the “comparative advantages” kind. In other words, if I say, “A”, I actually mean, “In SWI-Prolog, A much more so than in the other languages tech stacks I use”)

Q: Why are you using SWI-Prolog?
A: For several reasons. @jan is pragmatic in his technical choices, writes excellent documentation, fixes bugs and considers suggestions or improvements seriously. SWI-Prolog comes with a lot of well documented and useful libraries. SWI-Prolog is open source which means you can actually read what it does and even fix it or improve it yourself.

Q: Why do you write code in Prolog?
A: Because it is easier than anything else I have tried so far. True story. It gives me this WYSIWYG feeling, in the sense that I can look at code and know what will happen if I run it. It happens with the code I wrote two days ago and and code in the standard library. Why this is is a long story, I have even more opinions but I don’t want to go into that now.

Q: What new is out there?
A: A lot of libraries in SWI-Prolog that have codified some of the lessons from the books you’ve mentioned. New things like real “strings”, dicts. Again, the libraries for Web development. Tabling is an exciting new development and I hope to find the time to really figure out what it can and cannot do.

I hope you find those questions useful.


Also, you can find some of the “new” usage of prolog here: