Documentation

Manual

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

Examples

  • Likes – Use Prolog code to extract information from a Prolog database.
  • My little doge – Add a playable doge manipulating the DOM with Prolog.

Prolog Predicate Reference

Built-in predicates

Control Constructs
Term Unification
Clause Creation and Destruction
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_variables/2
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.
  • compare/3
  • \==/2 – Term not identical.
Type Testing
Logic and Control
  • once/1 – Evaluate a term just once.
  • repeat/0 – 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
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.
  • keysort/2
  • last/2 – Last element of a list.
  • length/2 – Length 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.
  • replicate/3 – Generate list by replicating an element.
  • reverse/2 – Invert the order of the elements in a list.
  • select/3
  • sort/2 – Checks standard order.
  • take/3 – Retrieve first elements of a list.
Higher Order

DOM module

:- use_module(library(dom)).
DOM Manipulation
Events
  • bind/4 – Bind a certain event to an HTML element.
  • event_property/3 – Extract a property's value of an event.
  • prevent_default/1 – Prevent default behaviour in an event.
  • unbind/2 – Unbind event linked to an HTML element.
  • unbind/3 – Unbind events linked to an HTML element which execute a certain goal.
Effects
  • hide/1 – Hide an HTML element.
  • show/1 – Show an HTML element.
  • toggle/1 – Toggle an HTML visibility.

Random module

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

Statistics module

:- use_module(library(statistics)).
Statistic Operations

JavaScript module

:- use_module(library(js)).
Invoking JavaScript Functions
  • apply/3 – Invoke a JavaScript global function with a list of arguments.
  • apply/4 – Invoke a JavaScript function with a list of arguments.
  • global/1 – Get the global JavaScript object.
  • prop/2 – Get a property of the JavaScript global object.
  • prop/3 – Get a property of a JavaScript object.

Implementation details

References