[top] [up] [next]

A first Prolog program (2)


5. Compile the file. By compiling the file it is checked for syntax errors and translated to an internal representation for Trinc-Prolog. To compile the text file:
  • Press the 'Compile' button on the toolbar of the text editor, or,
  • press the right mouse button in the text editor and select 'Compile' from the popup menu, or,
  • press the CTRL+F9 key combination.
6. A window appears in which properties of the file to compile can be entered, this window only appears if a file is compiled for the first time.
  • Press the OK button.
7. Switch to the main window of Trinc-Prolog now. It is possible to enter a goal that Trinc-Prolog will attempt to prove. Enter the following text in the goal combobox:
person(Name, Year, Sex).
8. To start proving the goal:
  • Press the 'Prove' button on the toolbar of the main window, or,
  • press the 'Enter' key, or,
  • press the F9 key combination.
9. In the output window the following text is displayed:
SOLUTION:
  Name=kate
  Year=1973
  Sex=female
This is the first solution of the goal, to view more solutions:
  • Press the F9 key, or,
  • press the 'Continue' button.

Keep pressing the F9 key until the word 'no' is displayed. The word 'no' indicates that no more solutions can be found. All the solutions are now visible.

SOLUTION:
  Name=kate
  Year=1973
  Sex=female
SOLUTION:
  Name=jeff
  Year=1971
  Sex=male
SOLUTION:
  Name=mary
  Year=1941
  Sex=female
SOLUTION:
  Name=john
  Year=1939
  Sex=male
no
It is always possible to stop the proving of a goal by:
  • Pressing the CTRL+F2 key combination, or,
  • pressing the 'Cancel' button.

[top] [up] [next]

 

info@trinc-prolog.com