Documentation

Note that there is no reference implementation for ISO Prolog, so we've used the following documents as references:

Manual

We are working on! Some pages may not be available yet (links colored in red).

Examples

  • Likes – This snippet uses Prolog code to extract information of a Prolog database, and then uses JavaScript to add the results to this same page by modifying the DOM.

Implementation details

Prolog Predicate Reference

Built-in predicates

Control Constructs
  • !/0 – Cut.
  • ,/2 – Conjunction.
  • ->/2 – If-Then.
  • ;/2 – Disjunction.
  • call/1 – Invoke a callable term as a goal.
  • catch/3 – Enable recovery from exceptions.
  • fail/0 – Always fail.
  • throw/1 – Raise an exception.
  • true/0 – Always succeed.
Term Unification
Clause Creation and Destruction
  • abolish/1 – Remove all the clauses of a predicate.
  • asserta/1 – Add term to the Prolog database.
  • assertz/1 – Add term to the Prolog database.
  • retract/1 – Delete term from Prolog database.
Clause Retrieval and Information
Term Creation and Decomposition
  • =../2 – Check the descomposition of a term.
  • arg/3 – Check the argument of a term in the nth position.
  • copy_term/2 – Copy one term without bounding the variables on it.
  • functor/3 – Check characteristics of a term.
Term Comparison
  • ==/2 – Term identical.
  • @</2 – Term less than.
  • @=</2 – Term less than or equal to.
  • @>/2 – Term greater than.
  • @>=/2 – Term greater than or equal to.
  • \==/2 – Term not identical.
Type Testing
Logic and Control
  • once/1 – Evaluate a term just once.
  • repeat/1 – Provide infinite choice points.
  • \+/1 – Not provable.
Atom Processing
All Solutions
  • bagof/3 – Find all the values that would make a goal succeed and structure them.
  • findall/3 – Find all the values that would make a goal succeed.
  • setof/3 – Find all the values that would make a goal succeed and organize and order them.
Arithmetic Evaluation
  • is/2 – Evaluate expression.
Arithmetic Comparison
  • </2 – Arithmetic less than.
  • =:=/2 – Arithmetic equal.
  • =</2 – Arithmetic less than or equal to.
  • =\=/2 – Arithmetic not equal.
  • >/2 – Arithmetic greater than.
  • >=/2 – Arithmetic greater than or equal to.
Implementation defined hooks
Input and Output
  • current_op/3 – Check properties of operator.
  • op/3 – Alter the operator table.

Lists module

:- use_module(library(lists)).
List Manipulation
  • append/3 – Join two lists.
  • drop/3 – Drop the first elements of a list.
  • exclude/3
  • filter/3 – Filter elements for which a goal succeeds.
  • foldl/4 – Reduce list to a single value.
  • include/3 – Filter elements for which a goal succeeds.
  • last/2 – Last element of a list.
  • length/2 – Length of a list.
  • map/3 – Apply goal to the elements of a list.
  • maplist/3 – Apply goal to the elements of a list.
  • max_list/2 – Largest element of a list.
  • member/2 – Check membership of element in list.
  • min_list/2 – Smallest element of a list.
  • nth0/3 – Get the Nth element of a list.
  • nth0/4 – Get the Nth element of a list and the rest of elements on it.
  • nth1/3 – Get the Nth element of a list.
  • nth1/4 – Get the Nth element of a list and the rest of elements on it.
  • permutation/2 – Permutation of list.
  • prod_list/2 – Product of the elements of a list.
  • reduce/4 – Reduce list to a single value.
  • replicate/3 – Generate list by replicating an element.
  • reverse/2 – Invert the order of the elements in a list.
  • sort/2 – Checks standard order.
  • take/3 – Retrieve first elements of a list.

Random module

:- use_module(library(random)).
Random Numbers