4 ms·
This is awesome. Why aren't we all programming this way?
by miguelrochefort 9y ago
This is awesome. Why aren't we all programming this way?
- zmonx 9y agoI am already doing it. Ready when you are!
- PaulHoule 9y agoIt's an interesting question. In the 1980s, there was a lot of interest in Prolog, particularly people thought it would be good for massively parallel programming since you don't have to specify the exact sequence things happen in. It was discovered pretty early that Prolog does not parallelize well, so that research went in another direction towards languages that were less expressive such as KL1. I think Prolog has not really caught on because the combination of imperative in logic programming is awkward. For instance, you might implement a loop that uses logical failure to backtrack (and run the next iteration of the loop) when you have what you think of as a true condition. Since then there has been a lot of interest in Datalog which is not a precisely-defined language with a particular syntax, but rather the pure logical core of Prolog which can be implemented in languages like Clojure or the SPARQL-RDF ecosystem, etc. On the other hand there are also "constraint programming" languages which are more expressive than Prolog as well as SAT/SMT solvers and other tools that use more complex solving and optimization strategies.
- zmonx 9y agoWith "constraint programming" languages, do you mean languages such as MiniZinc that provide dedicated syntax for some tasks? I am asking because support for constraint programming is among the most important and most distinguishing features of common Prolog systems: All widely used Prolog systems (GNU-Prolog, SICStus etc.) ship at least with a constraint solver over integers, and often with many more, such as constraints over Herbrand terms (dif/2), constraints over rational numbers and also constraints over Boolean variables (SAT constraints). So, support for constraint programming is typically provided also natively by Prolog systems, with a simple and also very expressive syntax that blends in seamlessly into Prolog like any other relation. There was a recent HN discussion about why Prolog is not yet more popular: https://news.ycombinator.com/item?id=14439137 https://news.ycombinator.com/item?id=14439137 In my view, Prolog implementations are now becoming interesting because they are now quite robust, feature-rich and also reasonably efficient.
- miguelrochefort 9y agoI actually started that thread about Prolog :) Recently, I've been looking at Mercury and Eve. I really thing logic programming is underrated.