Live data from Hacker News

Learn Prolog Now (2006)

lpn.swi-prolog.org

101–110 of 251 posts

Re: Learn Prolog Now (2006)

#101
I studied prolog back in 2014. It was used in AI course. I found it very confusing: trying to code A*, N-Queens, or anything in it was just too much. Python, in contrast, was a god-send. I failed the subject twice in my MSc (luckily passing the MSc was based on the total average), but did a similar course in UC Berkeley, with python: aced it, loved it, and learned a lot.

Never again :D

Re: Learn Prolog Now (2006)

#102
post #75

Earlier quoted context omitted.

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

I have the complete opposite view of web developers. :)

Maybe the ones these days are different. I left the field probably 15 years ago.

Re: Learn Prolog Now (2006)

#103

Earlier quoted context omitted.

Can you try calculating 101 * 70 in your head?

Very easy to solve, just like it is easy to solve many other ones once you know the tricks. I recommend this book: https://www.amazon.com/Secrets-Mental-Math-Mathemagicians-Ca...

Completely missing the point on purpose?

Re: Learn Prolog Now (2006)

#104

Earlier quoted context omitted.

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?

It’s almost like you’re proving the point of his reply…

Re: Learn Prolog Now (2006)

#105
post #76
post #26

Earlier quoted context omitted.

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!

pyswip is a one-way python-to-SWI-prolog interface; there's also a first-party (maintained as part of SWI-prolog), two-way one called janus-swi.

https://pypi.org/project/janus-swi/

https://www.swi-prolog.org/pldoc/man?section=janus-call-prol...

Re: Learn Prolog Now (2006)

#106

I studied prolog back in 2014. It was used in AI course. I found it very confusing: trying to code A*, N-Queens, or anything in it was just too much. Python, in contrast, was a god-send. I failed the subject twice in my MSc (luckily passing the MSc was based on the total average), but did a similar course in UC Berkeley, with python: aced it, loved it, and learned a lot. Never again :D

A similar thing happened at my university in an Advanced Algorithms course. Students failed it so much, the university was forced to make the course easier to pass, by removing the minimum grade to pass.

I believe your case (and many other students) is that you couldn't abstract yourself from imperative programming (python) into logic programming (prolog).

Re: Learn Prolog Now (2006)

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

While usually using native syntax rather than strings, somethign like that exists for most languages of any popularity (and many obscure ones), in the form of miniKanren implementations. https://minikanren.org/

If you really want something that takes Prolog strings instead (and want the full power of prolog), then there are bindings to prolog interpreters from many languages, and also SWI-Prolog specifically provides a fairly straightforward JSON-based server mode "Machine Query Interface" that should be fairly simple to interface with any language.

https://www.swi-prolog.org/pldoc/man?section=mqi-overview

Re: Learn Prolog Now (2006)

#110
post #86

Earlier quoted context omitted.

Even in your example (which is obviously not correct representation of prolog), that code will work X orders magnitude faster and with 100% reliability compared to much more inferior LLM reasoning capabilities.

This is not the point though

Algorithmically there's nothing wrong with using BFS/DFS to do reasoning as long as the logic is correct and the search space is constrained sufficiently. The hard part has always been doing the constraining, which LLMs seem to be rather good at.
Post reply on HN