Merge pull request #2 from triska/get_single_char

New feature: RET can now be used as a synonym for "." in the interaction
This commit is contained in:
notoria
2020-04-18 18:51:37 +02:00
committed by GitHub
2 changed files with 8 additions and 10 deletions

View File

@@ -168,8 +168,8 @@ predicates it defines. For example, with the program shown above:
; What = pure_world. ; What = pure_world.
``` ```
Press `SPACE` to show further answers, if any exist. Press `.` to Press `SPACE` to show further answers, if any exist. Press `RETURN` or
abort the search and return to the toplevel prompt.  `.` to abort the search and return to the toplevel prompt.
Press `h` to show a help message. Press `h` to show a help message.
To quit Scryer Prolog, use the standard predicate `halt/0`: To quit Scryer Prolog, use the standard predicate `halt/0`:

View File

@@ -146,24 +146,22 @@
'$read_input'(ThreadedGoals, NewVarList) :- '$read_input'(ThreadedGoals, NewVarList) :-
get_single_char(C), get_single_char(C),
( C == w -> ( C = w ->
nl, nl,
write(' '), write(' '),
'$write_eq'(ThreadedGoals, NewVarList, 0), '$write_eq'(ThreadedGoals, NewVarList, 0),
'$read_input'(ThreadedGoals, NewVarList) '$read_input'(ThreadedGoals, NewVarList)
; C == p -> ; C = p ->
nl, nl,
write(' '), write(' '),
'$write_eq'(ThreadedGoals, NewVarList, 20), '$write_eq'(ThreadedGoals, NewVarList, 20),
'$read_input'(ThreadedGoals, NewVarList) '$read_input'(ThreadedGoals, NewVarList)
; C == (';') -> ; member(C, [';', ' ', n]) ->
nl, write('; '), false nl, write('; '), false
; C == (' ') -> ; C = h ->
nl, write('; '), false
; C == h ->
'$help_message', '$help_message',
'$read_input'(ThreadedGoals, NewVarList) '$read_input'(ThreadedGoals, NewVarList)
; C == '.' -> ; member(C, ['\n', .]) ->
nl, write('; ...'), nl nl, write('; ...'), nl
; '$read_input'(ThreadedGoals, NewVarList) ; '$read_input'(ThreadedGoals, NewVarList)
). ).
@@ -171,7 +169,7 @@
'$help_message' :- '$help_message' :-
nl, nl, nl, nl,
write('SPACE, "n" or ";": next solution, if any\n'), write('SPACE, "n" or ";": next solution, if any\n'),
write('".": stop enumeration\n'), write('RETURN or ".": stop enumeration\n'),
write('"h": display this help message\n'), write('"h": display this help message\n'),
write('"w": write terms without depth limit\n'), write('"w": write terms without depth limit\n'),
write('"p": print terms with depth limit\n\n'). write('"p": print terms with depth limit\n\n').