The Power of Prolog
31–40 of 69 posts
Re: The Power of Prolog
#32Earlier quoted context omitted.
Prolog is a deep language and can teach so you a lot. The main problem is that any prolog program bigger than, say, a thousand lines of code become difficult to debug and understand. There are ways to make things better e.g. avoid impure prolog etc. but it is still problematic. Engineers are always looking for technologies to hop onto. Prolog is niche for a reason: I don’t think Prolog scales. In some ways it is too…
On the other hand, with dozens of lines of Prolog you can solve some problems that would take many thousands of lines in other languages (and a lot of calm study before you can map them into a real logic or imperative algorithm). I still avoid it, because yeah, once you solve that problem and avoid those thousands of lines, you are stuck. If you try make the rest of your system in Prolog, it will become a non-viable…
Re: The Power of Prolog
#33Earlier quoted context omitted.
On the other hand, with dozens of lines of Prolog you can solve some problems that would take many thousands of lines in other languages (and a lot of calm study before you can map them into a real logic or imperative algorithm). I still avoid it, because yeah, once you solve that problem and avoid those thousands of lines, you are stuck. If you try make the rest of your system in Prolog, it will become a non-viable…
I'm not familiar with Prolog and this statement sounds insane. I'm not doubting you exactly, it's just not something I can concieve. Can you provide an example of a problem that would only take a few dozen lines of Prolog which would take several thousand lines in another, "normal", language?
Basically, Prolog is declarative programming. You can attach properties to your data and then define relations between the data based on whether they have that property (or not). Something along the lines of: X is grandfather of Y if X is man and X has child Z which has child Y.
The above statement is very simple to write, a couple of lines. This will perform depth first search (or breadth first with some longer algirithm) using your data. As a result, Prolog can provide all such matches of all your data, or just the grandchildren of X, or both grandfathers of Y, etc.
Anyway, what you are really getting is just a good implementation of the search through the relations based on constraints. The main reason Prolog is used is because other languages just don't provide a good library for constraint based search through your data.
Re: The Power of Prolog
#34How can I embed a prolog program in a python long running API server? Same but in Go? JVM?
Re: The Power of Prolog
#35What prolog needs is an integration story. How can I embed a prolog program in a python long running API server? Same but in Go? JVM?
These days SWI-Prolog even has a library for Redis.
Re: The Power of Prolog
#36Prolog is the only language that I've ever learned that feels like magic. Of course, it's not, but it feels like that. I'm still learning it, but I feel it and the logic paradigm are underused. I wonder if it's fair to consider it constraint-based programming rather than just logic programming. I used the book Thinking as Computation to learn it (and still am), and that's what it felt like we were doing in the book:…
What scenarios have you used it for?
I do have some ideas for some apps I'd like to tackle at some point. Those primarily consist of interacting with system constraints.
Re: The Power of Prolog
#37Prolog always seemed to me like a database query language that can be tricked into computation.
The interesting thing is that 1000000000's of people use SQL every day and not so many Prolog....
Re: The Power of Prolog
#38Earlier quoted context omitted.
I'm not familiar with Prolog and this statement sounds insane. I'm not doubting you exactly, it's just not something I can concieve. Can you provide an example of a problem that would only take a few dozen lines of Prolog which would take several thousand lines in another, "normal", language?
It's been more than a decade since I worked in Prolog, so I cannot give you a direct example but can try to answer :) Basically, Prolog is declarative programming. You can attach properties to your data and then define relations between the data based on whether they have that property (or not). Something along the lines of: X is grandfather of Y if X is man and X has child Z which has child Y. The above statement is…
Re: The Power of Prolog
#39Earlier quoted context omitted.
It's criminally underused , and it's a weird blind spot for software developers to have. My input on this is that our primary working tool, a programming language, is so powerful and wide that (within the limits of computability) it can literally do anything; therefore we are less likely to question the paradigm or look for a different one, even when it would be more suited to the problem at hand.
Prolog is a deep language and can teach so you a lot. The main problem is that any prolog program bigger than, say, a thousand lines of code become difficult to debug and understand. There are ways to make things better e.g. avoid impure prolog etc. but it is still problematic. Engineers are always looking for technologies to hop onto. Prolog is niche for a reason: I don’t think Prolog scales. In some ways it is too…
Sounds like there is a use case for abstraction? Category theory maybe?
Re: The Power of Prolog
#40What prolog needs is an integration story. How can I embed a prolog program in a python long running API server? Same but in Go? JVM?