Hacker News new | ask | show | jobs
by throwaway2380 2192 days ago
I've been trying to push myself to learn Prolog, using this book, because Prolog seems like a very elegant way of modeling the interactions between business rules, compared to the bespoke functions I typically write during web app jobs.

I have no complaints about the book, but I've been struggling to figure out an easy setup for "Prolog as a web app backend." Typical Prolog implementations are not designed to be used as concurrently-accessed databases. Datalog seems to be a nearby technology that is more pointed towards that use case, but even then, there seem to be scant few implementations of Datalog databases with transaction support, and near zero that are open source.

RDF/OWL databases seem to be another conceptually-near possibility, but they also seem to have few implementations that are prepared for high-scale concurrent access.

Overall, it seems that there is a decent amount of interest in "logic-type" query languages as a curiosity, but little attention to implementations that support use in OLTP business applications, which makes adoption difficult.

Does anybody have any advice?

5 comments

I recently participated in an online Prolog class by Anne Ogborn. It utilized SWI-Prolog [2] and SWISH [3], and mentioned Pengines [4] for web. I haven't used it personally, but that is the pointer I have for Prolog + web.

[1] https://twitter.com/AnnieTheObscure [2] https://www.swi-prolog.org/ [3] https://swish.swi-prolog.org/ [4] https://pengines.swi-prolog.org/docs/index.html [5] http://pathwayslms.com/swipltuts/ [6] https://www.youtube.com/watch?v=JmOHV5IlPyU

I'm also curious about this, and what "real world" Prolog actually look like.

On one hand, I think the paradigm really simplifies some things, but then on the other hand, everything else (aka routine programming tasks) seems much more convoluted and awkward.

I think PAIP may have been on to something, embedding Prolog in Lisp, but that's less elegant and more difficult in most other languages.

Swi-Prolog, a popular, free and open source implementation of Prolog, has good support for web development. The Swi-Prolog website itself is written using Swi-Prolog's http libraries.

There are a couple of tutorials listed under Tutorials > Web applications on the website. Probably the place to start is:

Tutorial — Creating Web Applications in SWI-Prolog

http://www.pathwayslms.com/swipltuts/html/index.html

Agree - rules engines are legion in commercial envs and a decent language or accessible non Java reit engine is something on my shopping list too.