From 6dcefcfb716680437575ec19bfbe8d0b44d6a0ec Mon Sep 17 00:00:00 2001 From: Markus Triska Date: Sat, 18 Apr 2020 17:40:19 +0200 Subject: [PATCH 1/3] small simplifications --- src/prolog/toplevel.pl | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/prolog/toplevel.pl b/src/prolog/toplevel.pl index f2adba33..09131d6d 100644 --- a/src/prolog/toplevel.pl +++ b/src/prolog/toplevel.pl @@ -146,24 +146,22 @@ '$read_input'(ThreadedGoals, NewVarList) :- get_single_char(C), - ( C == w -> + ( C = w -> nl, write(' '), '$write_eq'(ThreadedGoals, NewVarList, 0), '$read_input'(ThreadedGoals, NewVarList) - ; C == p -> + ; C = p -> nl, write(' '), '$write_eq'(ThreadedGoals, NewVarList, 20), '$read_input'(ThreadedGoals, NewVarList) - ; C == (';') -> + ; member(C, [';', ' ']) -> nl, write('; '), false - ; C == (' ') -> - nl, write('; '), false - ; C == h -> + ; C = h -> '$help_message', '$read_input'(ThreadedGoals, NewVarList) - ; C == '.' -> + ; C = '.' -> nl, write('; ...'), nl ; '$read_input'(ThreadedGoals, NewVarList) ). From 98a32790cd5991b3c438511178b5c34225e010ba Mon Sep 17 00:00:00 2001 From: Markus Triska Date: Sat, 18 Apr 2020 17:47:24 +0200 Subject: [PATCH 2/3] ENHANCED: the toplevel interaction now supports RETURN as a synonym for "." This is made possible due to the recent improvements by @notoria. --- README.md | 4 ++-- src/prolog/toplevel.pl | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 4fa1bab5..652e7b98 100644 --- a/README.md +++ b/README.md @@ -168,8 +168,8 @@ predicates it defines. For example, with the program shown above: ; What = pure_world. ``` -Press `SPACE` to show further answers, if any exist. Press `.` to -abort the search and return to the toplevel prompt. +Press `SPACE` to show further answers, if any exist. Press `RETURN` or + `.` to abort the search and return to the toplevel prompt. Press `h` to show a help message. To quit Scryer Prolog, use the standard predicate `halt/0`: diff --git a/src/prolog/toplevel.pl b/src/prolog/toplevel.pl index 09131d6d..6cee5ecc 100644 --- a/src/prolog/toplevel.pl +++ b/src/prolog/toplevel.pl @@ -161,7 +161,7 @@ ; C = h -> '$help_message', '$read_input'(ThreadedGoals, NewVarList) - ; C = '.' -> + ; member(C, ['\n', .]) -> nl, write('; ...'), nl ; '$read_input'(ThreadedGoals, NewVarList) ). @@ -169,7 +169,7 @@ '$help_message' :- nl, nl, 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('"w": write terms without depth limit\n'), write('"p": print terms with depth limit\n\n'). From 2ae5472872b11110f014670edd548839c2f12da5 Mon Sep 17 00:00:00 2001 From: Markus Triska Date: Sat, 18 Apr 2020 18:08:08 +0200 Subject: [PATCH 3/3] reintroduce "n" as a synonym for ";" and " " --- src/prolog/toplevel.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/prolog/toplevel.pl b/src/prolog/toplevel.pl index 6cee5ecc..aad24573 100644 --- a/src/prolog/toplevel.pl +++ b/src/prolog/toplevel.pl @@ -156,7 +156,7 @@ write(' '), '$write_eq'(ThreadedGoals, NewVarList, 20), '$read_input'(ThreadedGoals, NewVarList) - ; member(C, [';', ' ']) -> + ; member(C, [';', ' ', n]) -> nl, write('; '), false ; C = h -> '$help_message',