Our great sponsors
-
language-incubator
Learning compilers, interpreters, code generation, virtual machines, assemblers, JITs, etc.
-
InfluxDB
Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
-
precautionary
Patient-centered safety diagnostics for oncology dose-escalation trials, examining design safety in light of inter-individual variation in PKPD.
-
WorkOS
The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.
-
souffle
Soufflé is a variant of Datalog for tool designers crafting analyses in Horn clauses. Soufflé synthesizes a native parallel C++ program from a logic specification.
-
SaaSHub
SaaSHub - Software Alternatives and Reviews. SaaSHub helps you find the best software and product alternatives
I'm trying to source some programs and libraries written in Prolog to gain a better understanding of how a complete application is put together. Lots of Hello, World-esque examples out there, but looking for things that are a little less trivial.
I did come across terminusdb: https://github.com/terminusdb/terminusdb which looks interesting.
Any other codebases people would recommend that are worth a read?
Not exactly a big codebase, but it was a revelation for me how natural typecheckers can feel in Prolog: I basically rewrote typing rules with some tweaks: [1]
Also, tests were surprisingly enjoyable in Prolog: [2].
[1] https://github.com/EarlGray/language-incubator/blob/29755c32...
One of the most interesting applications of Prolog I have seen in the recent past is the formalization of dose finding trials that occur in clinical oncology. In particular, David C. Norris has implemented a Prolog formulation of the Cumulative Cohort Design (CCD) as part of his precautionary package:
https://github.com/dcnorris/precautionary/blob/main/exec/pro...
This formulation can be used to exhaustively enumerate all possible arising cases, and also complete partially given information. It is possible to ask interesting questions about the trial as a whole, such as whether specific cases can arise. In this sense, the formulation truly serves as a declarative specification of trial designs that are otherwise stated only comparatively informally in the medical literature, and even subject to divergent interpretations.
I made this demo project a while back, you might find it useful:
https://www.sciencedirect.com/science/article/pii/S074771718...
Source: https://github.com/maths/PRESS
- - - -
BTW, Does anyone know where I can find the source for MIXTUS partial evaluation system?
Link for those interested: https://github.com/bitlaw-jp/the-constitution-of-japan
figlet is the classic tool to generate these, toilet is a slightly more modern reimplementation with some added features (like color)
Not a lot of code but a somewhat different use of Prolog than you're likely to see elsewhere. I used my fork of a MQTT library for Prolog (https://github.com/sprior/swi-mqtt-pack) to implement the central controller for my home automation system. The system responds to MQTT events and then coordinates the appropriate action by sending MQTT messages to other home services. Recent versions of SWI-Prolog also support redis and I've started using that to store device configuration and state between services. The MQTT version is actually a reimplementation of my previous version which used CORBA for inter-service communication.
I don't distribute the home automation code however it's pretty specific to my house. The MQTT library provides some building block examples.
Not an example of prolog but I wish Ed had time to continue developing https://github.com/ekmett/guanxi.
Not sure it is recommended reading, but maybe to see what else you could do with Prolog besides interpreters, DSLs etc:
As part of a knowledge systems course we built a game in (mostly) Prolog
I use it for reverse engineering unknown struct layouts for DWG classes. A field packing problem.
I'm using picat, a better Prolog dialect, and generate the facts automatically from C to generate the field layouts via picat automatically.
https://github.com/LibreDWG/libredwg/blob/master/examples/AC...
optimization problems as in compilers are extremely natural in Prolog.
Alpino is a natural language parser and generator for Dutch:
https://github.com/rug-compling/Alpino
Even in the age of neural parsers, it's still one of the most competitive parsers for Dutch.
Not sure if you'd consider this a "complete application" that is bigger than a "Hello-World-esque example" but I've worked on a Discord bot in SWI Prolog[1] for a while with a friend. It was an interesting experience and although a lot of the work (e.g. SWI has a ready-made library for interfacing with WebSockets and sending out HTTPS requests).
Some interesting applications of Prolog specifically include using predicates to filter messages by certain criteria (e.g. if it was sent by the bot's account or not), being able to hot-reload by invoking the make/0 predicate, and homoiconicity to (in theory) easily evaluate random code supplied by a user.
DFS Tools [0] is a Prolog implementation of the Distributional Formal Semantics framework [1].
Somewhat more widespread, the Open Policy Agent <https://www.openpolicyagent.org/> uses essentially a subset of prolog written in form more familiar to most programmers - but while the code looks more familiar, the semantics are derived from Prolog.
TerminusDB CTO here.
Echoing what triska said, CLP(ℤ) and friends are some of the most under-appreciated aspects of prolog implementations.
I'm amazed that programmers still don't have access to CLP when trying to do scheduling and planning solutions.
As an example in practice, what if you want to know about a transaction in which a number of entities transitively had holdings in one of the beneficiaries of the transaction at that particular time. The date window is not known, and the date windows are important in the ownership chain as well as the transactions that are being undertaken.
With CLP(FD) you can ask for a window of time, and the solution will zoom in on an appropriate time window which exists for the entire chain and match the time of the transaction.
Now try to do this query in SQL. It's almost impossibly hard.
I can't wait until I have the time to implement constraint variables for TerminusDB, but at the minute we are still working on more prosaic features.
Aside from that there are very interesting program correctness and optimisation systems which are based on prolog (usually a datalog). For instance Soufflé: https://souffle-lang.github.io