Tabling doesn't work in 8.4.0?

Hi all! I’m new to Prolog, I’m using SWI-Prolog version 8.4.0. on Mac OS X, installed via Homebrew. I’m trying to use tabling, but it doesn’t seem to be working. When I enter the example code from SWI-Prolog -- Manual with table connection/2. uncommented and run the example query, it hits the 1GB stack space limit. Any idea what I’m doing wrong?

$ cat test.prolog 
cat test.prolog 
table connection/2.

connection(X, Y) :-
        connection(X, Z),
        connection(Z, Y).
connection(X, Y) :-
        connection(Y, X).

connection('Amsterdam', 'Schiphol').
connection('Amsterdam', 'Haarlem').
connection('Schiphol', 'Leiden').
connection('Haarlem', 'Leiden').
$ swipl test.prolog 
Welcome to SWI-Prolog (threaded, 64 bits, version 8.4.0)
SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software.
Please run ?- license. for legal details.

For online help and background, visit
For built-in help, use ?- help(Topic). or ?- apropos(Word).

?- connection('Amsterdam', X).
connection('Amsterdam', X).
ERROR: Stack limit (1.0Gb) exceeded
ERROR:   Stack sizes: local: 0.9Gb, global: 48.4Mb, trail: 0Kb
ERROR:   Stack depth: 6,340,760, last-call: 0%, Choice points: 6,340,753
ERROR:   Probable infinite recursion (cycle):
ERROR:     [6,340,760] user:connection('Amsterdam', _12681974)
ERROR:     [6,340,759] user:connection('Amsterdam', _12681994)
   Exception: (6,340,759) connection('Amsterdam', _12681904) ? a
% Execution Aborted

Must be :- table connection/2. Note the :-, turning this into a directive to the compiler rather than a clause.


Thank you!!! That did the trick indeed.