“Prolog” and “Hacking” are not two terms that are usually found in close proximity. In a matter of fact, most hackers I know do not consider Prolog as a programming language. Prolog is just that thing you learn in a principles of programming languages course, that demonstrates “what are declarative languages”. Afterwards, you forget about it and go back to program in some imperative language, just as Kernighan & Ritchie intended you to do.
You couldn’t get it more wrong.
Prolog is a programming language that has a specific domain. Just like SQL and relational databases, Perl and text processing, Erlang and distributed computing, Java and over-sized, badly-designed on-top-of-a-technological-stack-higher-than-the-empire-state-building so-called “enterprise applications” — Prolog is about facts and deduction rules, under the closed-world assumption. Its true that you could use it to manipulate general-purpose data structures (just like you can write one-off text processing scripts in Java) — But it’s not intended to. Prolog read facts and produces more facts using deduction rules. That’s it.
You might ask yourself “What’s that good for?”. Admittedly, the textbook examples are awful. We all know that the brother of your father is your uncle, and so on, there’s no real necessity to apply artificial intelligence technique to get that. Also, the “closed world” thing makes Prolog less applicable for general application development. However, there’s one domain that is made exactly of facts and rules in a closed world, and that’s were Prolog hacking is:
Software.
Requirements and implementations, problem domains, design models and source code, are all finite-sized sets of facts. Who-calls-who, what-implements-what and were-did-that-code-go are all queries on top of the closed world of a software project. Implementation patterns are deduction rules, and that’s just from the top of my head.
The most obvious evident to that trick is the fact that Prolog is the one language that does not need a fancy IDE, since that code (i.e., predicates with body) is treated in the exact same way as facts (i.e., predicates with no body). SWI-Prolog supports the following IDE-like predicates built-in:
- List the current predicates
- Cross-reference between predicates (i.e., who-calls-who)
- Online help on a predicate
- Predicate properties (arity, source file, line number, content)
- List a predicate
- Open a predicate in your favourite editor
- Find predicates with a similar name to what you typed (the DWIM predicate – “Do What I Mean”)
It’s true that most IDEs know to do exactly that, but Prolog itself knows too: It just taps its-own database.
Using this power for software modeling is another thing, and that’s more-or-less my next line of research, so more on that to come.
(Btw, I know I haven’t written in a while, but neither did Shakespeare, and he did not have to grade two exams and go on reserve duty.)

AFAIK Prolog was the first language to have GC, and first Erlang prototype was implemented in Prolog, so looking forward to read what cool things you do with it.