2

The Sicstus Prolog manual says to user "| ?- consult(user)." to enter clauses and to "to return to top-level, type ^D.". However, I am using Windows and the manual doesn't have Windows instructions. How can I return to query mode in Windows?

false
  • 10,264
  • 13
  • 101
  • 209
Daniel Sopel
  • 3,535
  • 4
  • 24
  • 17

2 Answers2

2

In many Prolog systems, like SICStus 4, you can enter the fact end_of_file. to finish consultation. This fact will not be consulted, it only serves to indicate the end.

(Warning: I am not a frequent user of Wind-ows. That is, I only have rdesktop for such activity.)

Should you ever have the need to define the fact end_of_file. in your program, write end_of_file :- true. instead.

If you enter end_of_file. as a query on the toplevel, many Prolog systems stop. You can circumvent this by entering true,end_of_file. instead.

This slightly bizarre behavior is by no means standardized.

false
  • 10,264
  • 13
  • 101
  • 209
0

I can't test it, but I think ^Z (Ctrl+Z) should play the same role as ^D (Ctrl+D) on Unix.

CapelliC
  • 59,646
  • 5
  • 47
  • 90
  • 1
    I observed that sometimes it is Ctrl+Z and then Enter. On Unix and Mac it is not necessary to presse Enter after the Ctrl-D. This seems to hold in line mode on Windows. Also the line needs to be empty. –  Mar 18 '12 at 11:57
  • Try `get_code(C).` and type Ctrl-Z with and without Enter. Yes, you have to type Enter to get a result which is `C = 26` on IF/Prolog. – false Mar 19 '12 at 23:23