Variables

Facts

Relations

Query


Result


        
result in s

Examples

Bugs

Some stuff returns false on the ScalaJS version but not on the JVM version

Explanation

Source code

This is a simple prolog-like relational language. It's like a programming language where functions only return true or false, but by leaving an argument as a variable, you can make the engine solve for that variable. The evaluation is similar to MiniKanren, but not quite the same.

The engine is written in Scala, but this frontend uses a partial embedding into JavaScript.

Variables

Write all the variables you might use in the variables box, comma separated

Facts

Write all your facts in the facts box, separated by semicolons. Facts look like a function call. Declaring a fact tells the engine that that fact holds for the given values, which should not be variables.

Relations

Write all your relations in the relations box, separated by semicolons. Relation declarations have the form:

 relation_name(args) :- body 
A relation is like a conditional fact. If the body holds, then the relation holds for the given arguments.

The body of a relation is actually plain JavaScript, but it has to be of type Formula, which is formed by the terms Var, Const, Tuple and the operators Eq, And, Or, or a fact call or relation call.