Live data from Hacker News

Learn Prolog Now (2006)

lpn.swi-prolog.org

71–80 of 251 posts

Re: Learn Prolog Now (2006)

#71
post #62

Earlier quoted context omitted.

What makes you think your brain isn't also brute forcing potential solutions subconciously and only surfacing the useful results?

Can you try calculating 101 * 70 in your head?

Um, that's really easy to do in your head, there's no carrying or anything? 7,070

7 * 101 = 707 * 10 = 7,070

And computers don't brute-force multiplication either, so I'm not sure how this is relevant to the comment above?

Re: Learn Prolog Now (2006)

#72

Always felt this would be language that Sherlock Holmes would use...so be sure to wear the hat when learning it

“A touch! A distinct touch!” cried Holmes. "You are developing a certain unexpected vein of pawky humour, Watson, against which I must learn to guard myself".

-- from "The Valley of Fear" by Arthur Conan Doyle.

Re: Learn Prolog Now (2006)

#74
post #62

Earlier quoted context omitted.

> "4. Prolog is good at solving reasoning problems." Plain Prolog's way of solving reasoning problems is effectively: for person in [martha, brian, sarah, tyrone]: if timmy.parent == person: print "solved!" You hard code some options, write a logical condition with placeholders, and Prolog brute-forces every option in every placeholder. It doesn't do reasoning . Arguably it lets a human express reasoning problems bet…

What makes you think your brain isn't also brute forcing potential solutions subconciously and only surfacing the useful results?

Just intuition ;)

Re: Learn Prolog Now (2006)

#75

I am once again shilling the idea that someone should find a way to glue Prolog and LLMs together for better reasoning agents. https://news.ycombinator.com/context?id=43948657 Thesis: 1. LLMs are bad at counting the number of r's in strawberry. 2. LLMs are good at writing code that counts letters in a string. 3. LLMs are bad at solving reasoning problems. 4. Prolog is good at solving reasoning problems. 5. ??? 6. LLM…

Prolog doesn't look like javascript or python so: 1. web devs are scared of it. 2. not enough training data? I do remember having to wrestle to get prolog to do what I wanted but I haven't written any in ~10 years.

It's been a while since I have done web dev, but web devs back then were certainly not scared of any language. Web devs are like the ultimate polyglots. Or at least they were. I was regularly bouncing around between a half dozen languages when I was doing pro web dev. It was web devs who popularized numerous different languages to begin with simply because delivering apps through a browser allowed us a wide variety of options.

Re: Learn Prolog Now (2006)

#76
post #26
post #15

Earlier quoted context omitted.

I keep wishing for "regex for prolog", ie: being able to (in an arbitrary language) express some functional bits in "prolog-ish", and then be able to ask/query against it. let prologBlob = new ProLog() prologBlob.add( "a => b" ).add( "b => c" ) prologBlob.query( "a == c?" ) == True (not exactly that, but hopefully you get the gist) There's so much stuff regarding constraints, access control, relationship queries that…

There are a bunch of libraries that will do this - here's one example of a python one: https://github.com/yuce/pyswip - and a ruby one: https://github.com/preston/ruby-prolog

Thanks for the reference! `pyswip` is the closest I've seen so far:

    pl.consult("some-facts.pl")
    pl.assertz("new(fact)")
    while pl.Query(...).nextSolution():
        print( X.value )
...will definitely keep it in my back pocket!

Re: Learn Prolog Now (2006)

#77
post #15

I've recently started modeling some of my domains/potential code designs in Prolog. I'm not that advanced. I don't really know Prolog that well. But even just using a couple basic prolog patterns to implement a working spec in the 'prolog way' is *unbelievably* useful for shipping really clean code designs to replace hoary old chestnut code. (prolog -> ruby)

I keep wishing for "regex for prolog", ie: being able to (in an arbitrary language) express some functional bits in "prolog-ish", and then be able to ask/query against it. let prologBlob = new ProLog() prologBlob.add( "a => b" ).add( "b => c" ) prologBlob.query( "a == c?" ) == True (not exactly that, but hopefully you get the gist) There's so much stuff regarding constraints, access control, relationship queries that…

You can do that in Racket, with the Racklog library¹. There's also Datalog² and MiniKanren and probably some other logic languages available.

[1] https://docs.racket-lang.org/racklog/index.html

[2] https://docs.racket-lang.org/datalog/index.html

Re: Learn Prolog Now (2006)

#78

I am once again shilling the idea that someone should find a way to glue Prolog and LLMs together for better reasoning agents. https://news.ycombinator.com/context?id=43948657 Thesis: 1. LLMs are bad at counting the number of r's in strawberry. 2. LLMs are good at writing code that counts letters in a string. 3. LLMs are bad at solving reasoning problems. 4. Prolog is good at solving reasoning problems. 5. ??? 6. LLM…

IIRC IBM’s Watson (the one that played Jeopardy) used primitive NLP (imagine!) to form a tree of factual relations and then passed this tree to construct Prolog queries that would produce an answer to a question. One could imagine that by swapping out the NLP part with an LLM, the model would have 1. a more thorough factual basis against which to write Prolog queries and 2. a better understanding of the queries it should write to get at answers (for instance, it may exploit more tenuous relations between facts than primitive NLP).

Re: Learn Prolog Now (2006)

#79

What kind of problems is Prolog helping to solve besides GOFAI, theorem proving and computational linguistics?

Scheduling, relational modeling, parsing. These things come up all the time. Look at DCG:s if you want to quickly become dangerous.

Re: Learn Prolog Now (2006)

#80
post #70

Learn it now? I learned back in the 80s... and have since forgotten

You might have forgotten the language but I bet it must have had some influence on how you think or write programs today. I don’t think the value of learning Prolog is necessarily that you can then write programs in Prolog, but that it shifts your perspective and adds another dimension to how you approach problems. At least this is what it has done for me and I find that still valuable today.
Post reply on HN