Stéphane Lens
Teaching assistant

Computer Science and Artificial Intelligence

Université de Liège

INFO0049-1, Knowledge representation


Course notes :

Tutorials :

Hints :

  • To show the whole answer with SWI-Prolog, use the following command at the top of your files :

    :- set_prolog_flag(toplevel_print_options, [quoted(true), portray(true), max_depth(0), attributes(portray)]).

Course Information :

Useful links :

C/C++ <-> SWI-Prolog interface :

  • 1. (Embedded SWI-Prolog in C Program) - Check if a number is prime :

      -> prime.c,

    Execute the command plld -o prime prime.c to compile.
  • 2. (Embedded SWI-Prolog in C++ Program) - Check if a number is prime :


    Execute the command plld -o prime to compile.
    (plld appelle g++ à la place de gcc si les fichiers ont pour extension *.cc|*.C|*.cxx|*.cpp)
  • 3. (SWI-Prolog calling a C function predicate) : (to do)
  • 4. (SWI-Prolog calling a C++ function predicate) : (to do)
  • 5. (with lists) - Sort a list using predefined predicate msort :

      -> sort.c ou

    Execute the command plld -o sort sort.c or plld -o sort to compile.
S. Lens - Valid XHTML 1.0 Strict
When you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth. (A. Conan Doyle)