Home  |   Notes  |   Languages  |   Programs  |   Homework

Re: p3 program halting

New Message Reply About this list Date view Thread view Subject view Author view

Stephen Edwards (edwards@CS.VT.EDU)
Tue, 13 Nov 2001 20:23:56 -0500


Message-ID:  <3BF1C7AC.35A536B0@cs.vt.edu>
Date:         Tue, 13 Nov 2001 20:23:56 -0500
From: Stephen Edwards <edwards@CS.VT.EDU>
Subject:      Re: p3 program halting

> ?- print_solution, halt; halt. /* Run it */

Steve was correct to point out this line. Note the semicolon. This
goal requests that the print_solution predicate be executed (which
calls your solution, then prints the result), then exits the interpreter.
The semicolon ("or") ensures that even if your solution fails (causing
print_solution to fail), the interpreter will still exit.

This is the form of the input produced by the Curator to run your
program.

When testing your program on your own, feel free to remove or comment
out this line. Alternatively, you can just remove the halt's from this
line:

  ?- print_solution.

Another option you may find useful is to comment out the tell/telling/told
lines in the print_solution predicate (two at the top and two at the
bottom). These calls temporarily redirect output to another file
("output.txt") instead of the screen. If you comment these out,
then running things interactively will be easier (plus, you won't
end up with output still being redirected because your solution failed,
and the last two redirect goals weren't processed).

                                -- Steve

--
Stephen Edwards            604 McBryde Hall          Dept. of Computer Science
e-mail      : edwards@cs.vt.edu           U.S. mail: Virginia Tech (VPI&SU)
office phone: (540)-231-5723                         Blacksburg, VA  24061-0106
-------------------------------------------------------------------------------


New Message Reply About this list Date view Thread view Subject view Author view

Home  |   Notes  |   Languages  |   Programs  |   Homework
copyright © 2001 Virginia Tech, ALL RIGHTS RESERVED
Class site maintained by Stephen H. Edwards <edwards@cs.vt.edu>