I did come across terminusdb: https://github.com/terminusdb/terminusdb which looks interesting.
Any other codebases people would recommend that are worth a read?
https://github.com/dcnorris/precautionary/blob/main/exec/pro...
This Prolog program can be used to exhaustively enumerate all possible arising cases, and also to complete partially given trials. In addition to the specific usage mode of telling the clinician what action to perform next after a sequence of events has occurred, it is also possible to ask interesting questions about the trial design as a whole, such as whether specific cases can arise at all, or whether a specific instance was performed according to the protocol. In this sense, the formulation truly serves as an executable specification of trial designs that are otherwise stated only comparatively informally in the medical literature, and may even be subject to divergent interpretations. The formulation uses Scryer Prolog and the latest Prolog language constructs (such as if_/3 and CLP(ℤ) constraints) to achieve a short and very general description. Such declarative specifications may help considerably to improve safety and efficiency of clinical trials, by making all steps and outcomes amenable to analysis and comparison.
Theorem provers and reasoning engines are also often implemented in Prolog. A recent example is solidarity by Jos De Roo:
https://github.com/josd/solidarity
Prolog is also frequently used for prototyping interpreters. For example, Adrián Arroyo Calle is working on a MIPS simulator written in Prolog:
https://github.com/aarroyoc/mipsie
Simon Forman has implemented a Prolog interpreter of Joy in which, remarkably, the declarative description also serves as a type inferencer and type checker:
https://git.sr.ht/~sforman/Thun/tree/master/item/source/thun...
Porting this code to Scryer Prolog could be an interesting project if it appeals to you. There is already an issue for it and pertaining discussion:
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
Also, tests were surprisingly enjoyable in Prolog: [2].
[1] https://github.com/EarlGray/language-incubator/blob/29755c32... [2] https://github.com/EarlGray/language-incubator/blob/29755c32...
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.
I don't distribute the home automation code however it's pretty specific to my house. The MQTT library provides some building block examples.
You can also see some other comments I've made on HN which describe some other details.
I have one other Prolog project that is part of a tool. It explains the relationship between potentially related people. It is used in financial surveillance.
Journal of Symbolic Computation
Volume 7, Issue 1, January 1989, Pages 71-84
"Solving symbolic equations with PRESS"
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?
https://github.com/hsk/bulletpl/blob/master/bulletpl/1943_ro...
It is a movement of the rolling fire of CAPCOM shooting game 1943.
Original Bullet ML DSL is XML base, however this version base Edinburgh Prolog format.
Cheers Hans
https://github.com/rug-compling/Alpino
Even in the age of neural parsers, it's still one of the most competitive parsers for Dutch.
As part of a knowledge systems course we built a small game in (mostly) Prolog
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.
Given that you have the following coins, 1¢ (i.e. 1 cent or $0.01), 5¢, 10¢, 25¢, 50¢, how many different ways are there to give change for a dollar? For example, one way would be to give 2x50c, another would be to give 100x1c. How many are there total?
In most languages this is not super easy to do unless you're very comfy with recursion.
In Prolog the solution is basically (pseudocode):
100 = a*50 + b*25 + c*10 + d*5 + e*1
and Prolog will just figure out all possible combinations for you.The challenge with Prolog as far as I understand is making things fast.
[0] https://github.com/hbrouwer/dfs-tools [1] https://www.sciencedirect.com/science/article/pii/S089054012...
eval(E1+E2,I):- eval(E1,I1),eval(E2,I2), I is I1+I2.
eval(E1E2,I):- eval(E1,I1),eval(E2,I2), I is I1I2.
:- eval(12+34,R),writeln(R),R=14.
:- halt.
Very simple Operational Semantics.
this mean
syntax
e ::= i | e+e | e * e
evaluation rule
-------------- (E-Int)
i1-->i1
e1-->i1 e2-->i2
i is i1+i2
------------------- (E-Plus)
e1+e2 --> i
e1-->i1 e2-->i2
i is i1i2
------------------- (E-Times)
e1*e2 --> i
It's a pretty wild concept, and there are tons of cool examples of what Prolog can do. Some examples are:
- A solver for Suduko puzzles: https://rosettacode.org/wiki/Sudoku#Prolog
- A simple game where you guess a person's age: https://rosettacode.org/wiki/Guess_the_number#Prolog
- A family tree program: https://rosettacode.org/wiki/Family_tree#Prolog