Live data from Hacker News

The Power of Prolog

metalevel.at

41–50 of 69 posts

Re: The Power of Prolog

#41

I have only had passing experience with Prolog, many moons ago. It feels like ... and this is hard to express without sounding like I am trivializing it ... it feels like Prolog has a pretty good future as domain-specific language as input to a library called by, well, other programming languages, but on its own, it's a "wow, that's neat" kind of language.

something like this?https://github.com/yuce/pyswip

Re: The Power of Prolog

#42
This month Prolog is ranked #21 on TIOBE, ahead of Rust (#28) and TypeScript (#43). This probably demonstrates the irrelevance of TIOBE more than it illustrates the relevance of Prolog.

I think people who don't need to use Prolog think of Prolog in a very idealized way, kind of how they think of other "principled" languages like Lisp or Rust. Many years ago, I took a course at Johns Hopkins called Computational Models of Cognition. It was taught partly in SWI-Prolog. We used Prolog as a simple DSL to write little logical programs. It was different, and fun, and kind of confusing.

But as soon as you want to take Prolog beyond elementary classroom use, you will find that it is a language like many others, and needs to expose a world of little QOL details that go beyond the elegant simplicity of term unification, like argument mode modifiers and continuations and such.

Re: The Power of Prolog

#43
post #38
post #33

Earlier quoted context omitted.

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…

So You are saying that there is really not much difference between prolog and lets say constraint solver written in Java (DSL on top of another language)? Because if this really true than now I understand why this language never caught on.

> now I understand why this language never caught on

Can you illuminate why the language being a constraint solver tells you why it didn't catch on?

Re: The Power of Prolog

#44
post #29

I've been using Prolog on and off for 20+ years (I actually bought and used Turbo Prolog by Borland under MS-DOS). I have to confess though, I've never quite understood Prolog or what it's for. I've followed Markus Triska and his Power of Prolog videos (watched all of them). I'd like to thank him for his work. This fellow is super smart about programming, and he appears to be singlehandedly re-inventing Prolog. His v…

I have studied Prolog from time to time over the years and occasionally I run across problems where it strikes me Prolog would be useful but I've never been able to justify adding it.

Lately I've encountered more offline/batch processing problems and I am planning to work on some reimplementations of my solutions in our usual languages using Prolog (as soon as I have some free time, so none too soon).

Re: The Power of Prolog

#45

Earlier 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…

I think Minikanren does a pretty good job of being an embeddable version of Prolog. It's not that difficult to implement in whatever language you choose and uses the host language's data structures, you just have to implement unification over those days structures (i.e. figure out how to make it a tree). The main things it can't do is function like a database, though even that might be possible if you get creative.

Re: The Power of Prolog

#46
post #38
post #33

Earlier quoted context omitted.

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…

So You are saying that there is really not much difference between prolog and lets say constraint solver written in Java (DSL on top of another language)? Because if this really true than now I understand why this language never caught on.

I think you should do more than read one 4 paragraph comment before you cement an opinion on anything

Re: The Power of Prolog

#48
I found that Prolog is excellent for one-shot solving perfectly well-defined Platonic problems. The moment there is some uncertainty, rough edges, user input, etc it becomes nasty. Is this your experience? Am I doing something wrong?

Re: The Power of Prolog

#50
post #38
post #33

Earlier quoted context omitted.

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…

So You are saying that there is really not much difference between prolog and lets say constraint solver written in Java (DSL on top of another language)? Because if this really true than now I understand why this language never caught on.

Oh, well, Prolog is just a good DSL for a constraint solver. Usually written in C, but you can do it on Java too.

As I said, I have never seen one integrated with any language (oh, well, now I have seen Flix).

Post reply on HN