Live data from Hacker News

The Power of Prolog

metalevel.at

11–20 of 69 posts

Re: The Power of Prolog

#11
post #6

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

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 mess before you even finish it.

That said, I think the main thing that Prolog is missing is easy integration with other languages. If I could define some environment in Haskell, pack it with some Prolog predicate and get a list back, I would use it all the time.

Re: The Power of Prolog

#13
post #4

Prolog 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?

Re: The Power of Prolog

#14
I've been using it to try and figure out the longest consecutive bus route journey in London (648-649-651, disappointingly short) and some other bus related shenanigans - all of this was much easier than using pretty much anything else.

But on the other hand, it can be really faffy to figure out why your recursive list printer is failing halfway through and restarting three items back...

Re: The Power of Prolog

#15

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…

There was a functional JVM language with built-in datalog that came through the other day. Datalog brings a lot of the value of pure prolog.

Re: The Power of Prolog

#16

I've been using it to try and figure out the longest consecutive bus route journey in London (648-649-651, disappointingly short) and some other bus related shenanigans - all of this was much easier than using pretty much anything else. But on the other hand, it can be really faffy to figure out why your recursive list printer is failing halfway through and restarting three items back...

This looks like a nice book. I just read the CLP section, which may do what you want.

Re: The Power of Prolog

#17
post #6

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

Are there any Prolog scripting engines or embeddable runtimes? It feels like the kind of thing where you might use it to solve a small part of your problem domain and leave the rest to a conventional language.

Re: The Power of Prolog

#18
post #6

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

I guess Erlang is the scalable Prolog in a way. Tiny blocks of logic, respawn.

Re: The Power of Prolog

#19
post #17

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…

Are there any Prolog scripting engines or embeddable runtimes? It feels like the kind of thing where you might use it to solve a small part of your problem domain and leave the rest to a conventional language.

To an extent, you get this with Datalog, which is an easily embeddable subset of pure Prolog.

I've been spending a ton of time with the language and its implementation through my day job, and I recently spoke about its use as a DSL for embedded knowledge bases: https://www.youtube.com/watch?v=lYLkaOq7WbU

Re: The Power of Prolog

#20
post #17

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…

Are there any Prolog scripting engines or embeddable runtimes? It feels like the kind of thing where you might use it to solve a small part of your problem domain and leave the rest to a conventional language.

Not exactly Prolog, but there is miniKanren. You can check a list of implementations here: http://minikanren.org/#implementations
Post reply on HN