]> Repositorios git - scryer-prolog.git/commitdiff
ADDED: "f" to enumerate the next 5 solutions, similar to GUPU.
authorMarkus Triska <[email protected]>
Wed, 2 Mar 2022 20:02:19 +0000 (21:02 +0100)
committerMarkus Triska <[email protected]>
Wed, 2 Mar 2022 20:05:49 +0000 (21:05 +0100)
README.md
src/toplevel.pl

index 105069ac0086838ea6acd07fbdac051607ee308e..f21351689931052d7671c114974b3113d376aa97 100644 (file)
--- a/README.md
+++ b/README.md
@@ -224,9 +224,10 @@ predicates it defines. For example, with the program shown above:
 ;  What = pure_world.
 ```
 
-Press `SPACE` to show further answers, if any exist. Press `RETURN` or
-&nbsp;`.` to abort the search and return to the toplevel&nbsp;prompt.
-Press&nbsp;`h` to show a help message.
+Press `SPACE` to show further answers, if any exist. Press `RETURN`
+or&nbsp;`.` to abort the search and return to the
+toplevel&nbsp;prompt. Press&nbsp;`f` to see the next 5 answers, and
+`a` to see all answers. Press&nbsp;`h` to show a help message.
 
 To quit Scryer Prolog, use the standard predicate `halt/0`:
 
index 72e59886e6593aca8c43921b699ff2cbbca82d16..90e0a3a8bda6864013aecdb9105710a6de50661f 100644 (file)
@@ -174,6 +174,7 @@ instruction_match(Term, VarList) :-
 submit_query_and_print_results_(Term, VarList) :-
     '$get_b_value'(B),
     bb_put('$report_all', false),
+    bb_put('$report_n_more', 0),
     '$call'(Term),
     write_eqs_and_read_input(B, VarList),
     !.
@@ -316,6 +317,10 @@ write_eqs_and_read_input(B, VarList) :-
 read_input(ThreadedGoals, NewVarList) :-
     (  bb_get('$report_all', true) ->
        C = n
+    ;  bb_get('$report_n_more', N), N > 1 ->
+       N1 is N - 1,
+       bb_put('$report_n_more', N1),
+       C = n
     ;  get_single_char(C)
     ),
     (  C = w ->
@@ -338,6 +343,9 @@ read_input(ThreadedGoals, NewVarList) :-
     ;  C = a ->
        bb_put('$report_all', true),
        nl, write(';  '), false
+    ;  C = f ->
+       bb_put('$report_n_more', 5),
+       nl, write(';  '), false
     ;  read_input(ThreadedGoals, NewVarList)
     ).
 
@@ -346,6 +354,7 @@ help_message :-
     write('SPACE, "n" or ";": next solution, if any\n'),
     write('RETURN or ".": stop enumeration\n'),
     write('"a": enumerate all solutions\n'),
+    write('"f": enumerate the next 5 solutions\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').