Live data from Hacker News

Ask HN: What's Prolog like in 2024?

news.ycombinator.com

81–90 of 289 posts

Re: Ask HN: What's Prolog like in 2024?

#81
If you are interested in small fun stuff, SWI-Prolog has network libraries. Just recently, I implemented a network gomoku (5-in-a-row) game in it for my school project: https://gitlab.mff.cuni.cz/volfmat1/prolog-network-gomoku. Turns out you can also write quite imperative-style code with it :D

Re: Ask HN: What's Prolog like in 2024?

#82
It's great to hear new people are interested in the language! I was enlightened a couple years ago and fell in love.

Currently I'm focusing on creating easy-to-use embeddings of Trealla Prolog using Wasm. You can find my TypeScript library here: https://github.com/guregu/trealla-js and Go library here: https://github.com/trealla-prolog/go. The goal is to make the libraries as painless as possible. Trealla is a portable and lightweight Prolog written in C that supports CLP(Z) and is broadly compatible with Scryer. It's quite fast! I'm currently using it for some expert system stuff at $work and as an internet forum embedded scripting language for $fun.

Speaking of Scryer, they recently got their WebAssembly build working and I hope to contribute a JS library for them in the future as their API stabilizes. Scryer and Trealla are both aiming for ISO compatibility, so it's my hope that we can foster an ecosystem for modern ISO Prolog and provide more embeddings in the future. It's super convenient to get logic programmer superpowers in your favorite language. Also check out Scryer's new website: https://www.scryer.pl/

For something on the silly side, check out https://php.energy. Prolog Home Page, it's web scale :-). It's proof that you can integrate Prolog with bleeding edge stuff like Spin (server-side wasm ecosystem).

Re: Ask HN: What's Prolog like in 2024?

#83

Prolog, and Constraint Programming especially are great to have in your toolbox. I’ve done research in the field for years, and my job in the industry today is writing Prolog. There are real issues with Prolog: - no proper module nor package system in the modern sense. - in large code bases extra-logical constructs (like cuts) are unavoidable and turn Prolog code into an untenable mess. SWI prolog has single-sided un…

You write Prolog code for a living? Where? Do you happen to have a story to share? I'm very curious.

Re: Ask HN: What's Prolog like in 2024?

#84

Prolog, and Constraint Programming especially are great to have in your toolbox. I’ve done research in the field for years, and my job in the industry today is writing Prolog. There are real issues with Prolog: - no proper module nor package system in the modern sense. - in large code bases extra-logical constructs (like cuts) are unavoidable and turn Prolog code into an untenable mess. SWI prolog has single-sided un…

> when you get how the types in every OO program is a Prolog program itself

"Any sufficiently complicated type system contains an ad hoc, informally-specified, bug-ridden, slow implementation of half of Prolog."

Re: Ask HN: What's Prolog like in 2024?

#85
post #5

Prolog itself is still developed and used in various settings (mostly swi-prolog?), but other languages and logic engines solve domain specific but similar problems better (rule engines, formal proof verifiers, etc). For exploratory work it can be useful. I have tried to use it in combination will LLMs unsuccessfully, partly because the domain was not specific enough. Otherwise you need a lot of real world knowledge…

Any answer here is a good one since the question is soooo unspecific :D. My professor is a staunch advocate for RDF/OWL, inference engines and stuff like that (hence why i also mentioned ontologies :D). The thing is that i think that the language itself has so much untapped potential and the world that i dived into with my studies is so vast, so full of stuff that it left me kind of dazed to be fair! I got some paper…

If you want to see something truly fascinating, take apart https://logtalk.org/ - it implements an OO system for prolog which gives you all sorts of advantages (the least of which being a not-terrible way of getting namespaces).

Reading "The Art of Prolog" and "The Craft of Prolog" was fun for me, as was learning how the Warren Abstract Machine works.

(I am not at all a prolog expert, merely a programmer who happens to be fascinated by it, so this is all dabbling on my end but hopefully provides some stuff that's fun to learn for you as well)

Re: Ask HN: What's Prolog like in 2024?

#86

With compliments to your prof ;), interest in Prolog just now is recovering from a year-long focus on W3C's RDF/SPARQL. TBL surely had an itch to scratch with regards to logical knowledge representation dating back even longer than the web [1]. But Prolog has broader applicability not only in logical/knowledge graph querying, but also in solving all kinds of discrete combinatorical optimization problems. Or, as the Q…

The problem w/ OWL is that everybody wants to work with first-order logic + math, but Gödel proved it isn't decidable.

For instance if I wanted to express financial regulations or business rules inside a bank or other business I'd need to use math: for instance to express the conditions for reserve requirements or approving a loan.

OWL is best thought of as a set of templates for generating first-order logic rules that are decidable and also (in theory) quick to evaluate with the Tableau algorithm.

In certain domains you might tolerate tools that are imperfect, like it isn't fair to expect a SMT solver to figure out this one

   x^N + y^N = z^N
where x,y,z and N are all positive integers with N>2. For that one it would try to find solutions and probably time out. For some similar problems (a different polynomial) it might give you an answer.

OWL doesn't want to go there which is a big reason people say "Nein Danke!"

Re: Ask HN: What's Prolog like in 2024?

#87
post #2

Not quite what you asked for, but as someone using it quite a lot back in the late '80s during a CS&AI degree, Prolog has its interesting features and I'm glad I used it, but I haven't missed it since. I do like declarative stuff, eg CSS!, and that remains a good memory.

Speaking of CSS, :has() [https://developer.mozilla.org/en-US/docs/Web/CSS/:has] brings it closer to the glory of Prolog. I cannot wait to abuse it in avant-garde Logic-Driven-Development.

Re: Ask HN: What's Prolog like in 2024?

#88

Earlier quoted context omitted.

I interviewed and helped hire Mark Thom, the original author of Scryer. I also follow Scryer with interest, even though most of my limited Prolog use has been with SWI Prolog (and one large project with ExperProlog in the 1980s). One thing to check out: Prolog plays fairly well with Python, providing opportunities for hybrid projects.

How do you normally use Prolog and Python together? I had looked into embedding logic programming within Python in the past, and found a lack of satisfying options, but maybe I didn't know where to look.

I have two short examples in one of my books that I am currently re-writing. Here is a link directly to the Python+ Prolog interop examples https://leanpub.com/pythonai/read#use-predicate-logic-by-cal...

Re: Ask HN: What's Prolog like in 2024?

#89

Earlier quoted context omitted.

I interviewed and helped hire Mark Thom, the original author of Scryer. I also follow Scryer with interest, even though most of my limited Prolog use has been with SWI Prolog (and one large project with ExperProlog in the 1980s). One thing to check out: Prolog plays fairly well with Python, providing opportunities for hybrid projects.

To playing well with Python, this was on a front page some time ago: https://arxiv.org/abs/2308.15893 "The Janus System: Multi-paradigm Programming in Prolog and Python"

Hey, thanks! That looks cool.

Re: Ask HN: What's Prolog like in 2024?

#90

The problem with Prolog is that it's based on unification, and small unification engines can be expressed in a few lines in any functional programming language. That narrows down the already small niche where one would choose Prolog by probably a few orders.

I've been using Prolog daily for the past 1.5 years. I've also implemented and used a Kanren in Elm, and there is simply a world of practical difference.
Post reply on HN