Live data from Hacker News

The Power of Prolog

metalevel.at

21–30 of 162 posts

Re: The Power of Prolog

#21
post #3
post #2

Thank you very much for the publicity, I greatly appreciate it! This book has been discussed on HN about one year ago: https://news.ycombinator.com/item?id=14045987 Since then, I have added the following new chapters: Prolog Business Cases: https://www.metalevel.at/prolog/business Sorting and Searching: https://www.metalevel.at/prolog/sorting Cryptography with Prolog: https://www.metalevel.at/prolog/cryptography Engi…

Very nice book. Do you know what companies are using prolog commercially?

Gerrit (the code review tool) uses Prolog internally

* https://gerrit.googlesource.com/prolog-cafe/

Re: The Power of Prolog

#22
post #12
post #9

One of my favorite languages, pity that is has had even harder time than Lisp getting mainstream acceptance.

Let's face it, procedural is just plain easier to debug because you can more easily split it into digestible and dissect-able chunks: divide-and-conquer. Perhaps functional and logical CAN readily have such features, but nobody either figured how, or have not figured out how to explain how to do dissection to normal people. (This is sometimes a criticism of SQL also, but the added WITH clause helps break up big queri…

No idea why you think functional programming can't do printf debugging. Even pure languages like Haskell have `unsafePerformIO` (or wrappers like https://hackage.haskell.org/package/base-4.11.1.0/docs/Debug... ).

Also functional programming heavily encourages splitting up code into digestible chunks (they're called functions ;) )

Re: The Power of Prolog

#23
post #2

Thank you very much for the publicity, I greatly appreciate it! This book has been discussed on HN about one year ago: https://news.ycombinator.com/item?id=14045987 Since then, I have added the following new chapters: Prolog Business Cases: https://www.metalevel.at/prolog/business Sorting and Searching: https://www.metalevel.at/prolog/sorting Cryptography with Prolog: https://www.metalevel.at/prolog/cryptography Engi…

I've shared this with anyone who will let me divert the conversation to Prolog. At work we have the Haskell folks, the Lispers who move everything towards Lisp, and I'm the one who moves every conversion towards Prolog, then I send the link to this. :-D

The older Lisp folks often have a Prolog integrated in their system...

Re: The Power of Prolog

#24
post #3

Earlier quoted context omitted.

Very nice book. Do you know what companies are using prolog commercially?

Yes Markus does know, and has sprinkled examples throughout the book! One need look no further than the first chapter to find them. One that was new and interesting to me is that gerritcodereview (by Google) is written in Prolog. https://gerrit.googlesource.com/gerrit/+/master/prolog/

It's written in Java but embeds prolog as a rules engine for deciding when a change may be submitted.

https://gerrit-review.googlesource.com/Documentation/prolog-...

Re: The Power of Prolog

#25
post #20

Earlier quoted context omitted.

I am curious if you used a visual debugger for prolog? (or for a procedural language) printing things to the console is the poor man debugger.

A big problem with visual debuggers is that they are too blunt of an instrument. Often I wish to examine specific things under specific conditions and thus use conditionals to narrow down what's being explored instead of bajillion breakpoints and/or log records. Debuggers could add conditional expressions, but then they'd be re-inventing WRITE statements anyhow. As far as the nearby statement that maybe I didn't lear…

> Debuggers could add conditional expressions, but then they'd be re-inventing WRITE statements anyhow.

SWI-Prolog's debugger can be invoked conditionally whenever you want from inside your running application. I've used it many times, and the code is simply:

    (Condition -> gtrace ; true)
It's true that you could stick a write there, but you would have to think about what pieces of data you will need. Your mileage may vary. I've found this style a lot more useful than "traditional" debuggers where you set breakpoints beforehand and hope you hit them, as you say.

> As far as the nearby statement that maybe I didn't learn dissection correctly, that may indeed be the case

The point was more specifically that you didn't learn Prolog properly (or at all) and don't realize that it forces you to dissect your code. As I said, in Prolog you cannot nest loops. You cannot nest loops. It's hard to write a big non-dissected piece of code if you cannot nest loops.

> perhaps the real problem is that nobody knows how to TEACH functional/logical programming right

I agree with regards to logic programming. We need better free tutorials. I don't particularly like the linked one, it feels like it doesn't start at a beginner's level. I would be interested if anyone who didn't know any Prolog before has managed to learn Prolog from it.

Re: The Power of Prolog

#26
post #2

Thank you very much for the publicity, I greatly appreciate it! This book has been discussed on HN about one year ago: https://news.ycombinator.com/item?id=14045987 Since then, I have added the following new chapters: Prolog Business Cases: https://www.metalevel.at/prolog/business Sorting and Searching: https://www.metalevel.at/prolog/sorting Cryptography with Prolog: https://www.metalevel.at/prolog/cryptography Engi…

I've shared this with anyone who will let me divert the conversation to Prolog. At work we have the Haskell folks, the Lispers who move everything towards Lisp, and I'm the one who moves every conversion towards Prolog, then I send the link to this. :-D

> I send the link to this. :-D

And what kind of reaction are you getting? As I just wrote elsewhere, I don't think this is useful for complete Prolog beginners to learn the language or even get a feel for it. Has anyone you sent this to come back with "that's neat, I read the first N chapters and have just written my first Prolog program on my own"?

Re: The Power of Prolog

#27
post #12

Earlier quoted context omitted.

Let's face it, procedural is just plain easier to debug because you can more easily split it into digestible and dissect-able chunks: divide-and-conquer. Perhaps functional and logical CAN readily have such features, but nobody either figured how, or have not figured out how to explain how to do dissection to normal people. (This is sometimes a criticism of SQL also, but the added WITH clause helps break up big queri…

I am curious if you used a visual debugger for prolog? (or for a procedural language) printing things to the console is the poor man debugger.

> printing things to the console is the poor man debugger.

You may want to try working with network before making this statement, when you cannot step through a function because of timeouts. Or maybe even looking at tracing debuggers, like strace, ltrace, or Erlang's gdb, which all do little more than "printing things to the console".

Logging (and logging-like tools) is a very important way of debugging services, you know.

Re: The Power of Prolog

#28
post #8

Earlier quoted context omitted.

Windows NT used to have a Prolog based system for handling interrupts, not sure how much of it is still relevant on W10.

I was pretty sure that it was for configuring network devices.

Actually, I think we are both right.

http://collaboration.cmc.ec.gc.ca/science/rpn/biblio/ddj/Web...

Re: The Power of Prolog

#29
post #20

Earlier quoted context omitted.

A big problem with visual debuggers is that they are too blunt of an instrument. Often I wish to examine specific things under specific conditions and thus use conditionals to narrow down what's being explored instead of bajillion breakpoints and/or log records. Debuggers could add conditional expressions, but then they'd be re-inventing WRITE statements anyhow. As far as the nearby statement that maybe I didn't lear…

> Debuggers could add conditional expressions, but then they'd be re-inventing WRITE statements anyhow. SWI-Prolog's debugger can be invoked conditionally whenever you want from inside your running application. I've used it many times, and the code is simply: (Condition -> gtrace ; true) It's true that you could stick a write there, but you would have to think about what pieces of data you will need. Your mileage may…

I learned logic programming before learning Prolog.

We got our introduction to it via the Tarkis' World book (90's edition).

https://ggweb.gradegrinder.net/tarskisworld

Re: The Power of Prolog

#30
post #2

Thank you very much for the publicity, I greatly appreciate it! This book has been discussed on HN about one year ago: https://news.ycombinator.com/item?id=14045987 Since then, I have added the following new chapters: Prolog Business Cases: https://www.metalevel.at/prolog/business Sorting and Searching: https://www.metalevel.at/prolog/sorting Cryptography with Prolog: https://www.metalevel.at/prolog/cryptography Engi…

A section on dynamic programming w.r.t. to modern AI techniques would complement it nicely considering the resurgence of the field :D
Post reply on HN