LANGUAGES

PROLOG.

Programming in logic, born in Marseille in 1972 around Alain Colmerauer and Philippe Roussel. You do not tell the machine how to compute: you describe facts and rules, then ask questions, and it searches for every answer. This cartridge carries the Prolog engine of VAILS, ported as is. The full reference, with every built-in predicate and an example run on the machine, is in French.

parent(jean, marie).
parent(marie, lucie).
grand_parent(X, Z) :- parent(X, Y), parent(Y, Z).
grand_parent(jean, Who)?

{'Who': 'lucie'}

Try it

  • In the machine, choose the PROLOG cartridge: the machine answers ?
  • A sentence ending with a full stop adds a fact or a rule: cat(tom).
  • A sentence ending with a question mark is a query: cat(X)? answers {'X': 'tom'}, then every other solution; Yes or No when there is nothing to name
  • A sentence may span several lines: the prompt becomes | until the full stop
  • RUN "3:FAMILLE": also HANOI, LISTES, CALCUL, COULEURS
  • EDIT opens the editor on the program, with Prolog colouring

The language

  • Lower-case atoms, upper-case variables, _ for anything, 'Quoted atom'
  • Rules head :- goal1, goal2., recursion, lists [a, b | Rest]
  • X is 2 * 3, mod, //, **, abs, sqrt, max, gcd…; comparisons <, =<, =:=, ==, \==
  • ! (cut), not and \+, ;, findall, forall, bagof, setof
  • member, append, length, reverse, nth0, sort, between, atom_concat, print…
  • trace=1 shows every unification, trace=0 stops it

The machine

  • SAVE "NAME" writes the program to a .PL file, LOAD "NAME" reads it back
  • RUN reads the program again from the start and asks its queries
  • NEW empties the database, LIST prints the program
  • DIR, DEVICE, NC and CLS are still the machine's; Escape stops a search that runs too long

The VAILS engine

The engine is the one in VAILS, the server of the VVL language, copied function by function: same reading rules, same search, same answers. Every test of the cartridge is checked against the answer of the original engine. Its habits are therefore its own: a query ending with ? rather than starting with ?-, and a search limited to 200,000 steps per query.