Prolog is a general-purpose logic programming language associated with artificial intelligence and computational linguistics.

Prolog has its roots in first-order logic, a formal logic, and unlike many other programming languages, Prolog is declarative: the program logic is expressed in terms of relations, represented as facts and rules. A computation is initiated by running a query over these relations.

– wpédia

Anyway I just learnt that I should know this language within two days so let us try.

Hello world, because traditions and stuff:

% This is a comment!
printHelloWorld :-
    write('Hello world !'),
    nl.
/* And these...
    ... are comments as well. */

Funny thing every line finishes with a PUNKT.

Prolog is dynamically typed (aka I don’t care of my variables’ type), with a single data type, the term. Subtypes: Atom (e.g. [], x, ‘stuff’, ‘other stuff’, …), numbers, variables, and compound (aka « functions »). Variables start with a capital letter constants with a lower case letter.

Prolog works with clauses. There are two kind of clauses, rules and facts

Rule: Head is TRUE if Body is TRUE.

Head :- Body.

Fact: a Head with a Body always TRUE.

truc(x, y).