Live data from Hacker News

The Power of Prolog

metalevel.at

81–90 of 162 posts

Re: The Power of Prolog

#81
Prolog was one of hot A.I. prospects of the 1980s. It could be a way to build an expert system. Japanese fifth generation computers were supposed to,run it fast.

Then A.I. boom fizzled. Neither the first or last business cycle.

Re: The Power of Prolog

#82
used prolog many years ago, how is it now? is it evolving?

it IS the language for expert systems, curious if it can be the best language for general AI developments.

Just installed prolog under ubuntu and vscode has a plugin for it, all look good, will play with this more.

Re: The Power of Prolog

#84

Earlier quoted context omitted.

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

Yes, but we are stuck in our ways. We like all sorts of languages, some for instance talking enough about J got me learning J. Someone else not shutting up about rust got me looking into rust. Me not shutting up about golang got other's to check it out. I got the entire company on typescript instead of javascript. :-) Our normal tech stack is pretty boring and safe. But I'm glad there's a few folks who are open minded and trying something else. No one has used prolog in production that I know of but me. I used it to validate some business rules.

Re: The Power of Prolog

#85
post #83

From my experience the hardest part is interaction with other programs and libraries. Still cannot make pipes work in https://github.com/XVilka/r2pipe.prolog/blob/master/r2pipe.p...

What's the problem you're having with it? I think this was discussed on irc recently? This was the example I gave of using process_create which works:

    process_create('/bin/cat',
                   [], 
                   [stdout(pipe(Out)),stdin(pipe(In))]),  
    write(In, "hello"), nl(In), close(In), 
    read_line_to_codes(Out, Codes).

Re: The Power of Prolog

#86
post #44

Earlier quoted context omitted.

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

Regarding your last sentence: Yes, I can confirm that this has happened, to a reasonable extent of "learned" in the sense that people went on to write programs using this material. However, I do not know how common this is, since I almost exclusively get feedback from those who found the material suitable. There were definitely complete beginners among them. For instance, here is a discussion that happened a few mont…

> In my experience, learning Prolog properly requires dedicated guidance, and it would be highly unusual to achieve mastery without it.

Where would you find such a master, though... If you are not studying at a university where Prolog is taught, you're pretty much out of luck, I think. (I am assuming that asking questions in newsgroups/IRC/etc is not a substitute for it.)

Re: The Power of Prolog

#87
post #44

Earlier quoted context omitted.

Regarding your last sentence: Yes, I can confirm that this has happened, to a reasonable extent of "learned" in the sense that people went on to write programs using this material. However, I do not know how common this is, since I almost exclusively get feedback from those who found the material suitable. There were definitely complete beginners among them. For instance, here is a discussion that happened a few mont…

> In my experience, learning Prolog properly requires dedicated guidance, and it would be highly unusual to achieve mastery without it. Where would you find such a master, though... If you are not studying at a university where Prolog is taught, you're pretty much out of luck, I think. (I am assuming that asking questions in newsgroups/IRC/etc is not a substitute for it.)

Yes, I agree. I was lucky enough to study where the current convenor of the Prolog ISO working group teaches, using a Prolog- and Elisp-based teleteaching environment that he has built over several decades.

As in other disciplines, if you are elsewhere, you may have to move to get close to a master. This is not so unusual, is it? Vienna is a nice city for studying logic, and does attract students from all over the world!

Re: The Power of Prolog

#88
post #85
post #83

From my experience the hardest part is interaction with other programs and libraries. Still cannot make pipes work in https://github.com/XVilka/r2pipe.prolog/blob/master/r2pipe.p...

What's the problem you're having with it? I think this was discussed on irc recently? This was the example I gave of using process_create which works: process_create('/bin/cat', [], [stdout(pipe(Out)),stdin(pipe(In))]), write(In, "hello"), nl(In), close(In), read_line_to_codes(Out, Codes).

Well, I need to keep both pipes open during the "session", since usual radare2 session involves hundreds of commands and their output. Opening a new pipe and process every time is a wrong way to go in my opinion.

Re: The Power of Prolog

#89
post #88
post #85

Earlier quoted context omitted.

What's the problem you're having with it? I think this was discussed on irc recently? This was the example I gave of using process_create which works: process_create('/bin/cat', [], [stdout(pipe(Out)),stdin(pipe(In))]), write(In, "hello"), nl(In), close(In), read_line_to_codes(Out, Codes).

Well, I need to keep both pipes open during the "session", since usual radare2 session involves hundreds of commands and their output. Opening a new pipe and process every time is a wrong way to go in my opinion.

You should be able to open the pipes at the beginning of the session, and close them after, passing the pipe variables around as needed. Prolog wouldn't be any different to other programming languages there. What errors are you getting? Maybe post to the swipl mailing list?

Re: The Power of Prolog

#90

Its so nice to hear Prolog is alive and well. While at university I spent quite some time wrangling with it and grew to love it. So much problem solving smarts built into the runtime. Here is my crowning achievement from back then in 1993 - a genetic programming simulator that evolved ants to follow pheromone trails in pure prolog. http://www.cs.cmu.edu/Groups/AI/areas/genetic/gp/systems/gp_... Enjoy.

Nerd.

In 2005 I used Prolog to a solved pathfinding for competive maps in CS 1.6 based off weighted examples form interviewing a 'professionals' calls, even had a plugin architecture to extend each map, though it only worked well for Dust2 before I had to present. Way more practical. Cough.

That was fun. Now I want to find the code...

Post reply on HN