University of Toronto - Winter 2007
Department of Computer Science

CSC 324: Principles of Programming Languages

Assignment 5
Clarification Page


General Comments

Displaying long lists in SWI Prolog
Some of you may have noticed that for long lists or terms SWI displays part of the list (or term) and then "...".
This does not help debugging the code, of course, since your lists in assignment 5 are long.
For example,

?- append([1,2,3],[4,5,6,7,8,9,10,11], X).

X = [1, 2, 3, 4, 5, 6, 7, 8, 9|...] ;

No

You can press w to force Prolog to display the entire list. It will then remember this option for the entire session.
For example,

?- append([1,2,3],[4,5,6,7,8,9,10,11], X).

X = [1, 2, 3, 4, 5, 6, 7, 8, 9|...] press w [write]

X = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11] ;

No

Alternatively, you can use the following directive:

set_prolog_flag(toplevel_print_options,[quoted(true)]).


Question-Specific Clarifications

Question 4
You do not have to write a linear reversePath/2, i.e. you do not have to use an accumulator variable.

Back to the main page