From d54c3369b3812ce2071b7676a035732fe864fce4 Mon Sep 17 00:00:00 2001 From: Markus Triska Date: Tue, 5 Sep 2023 19:39:05 +0200 Subject: [PATCH 1/2] FIXED: countall/2 for zero solutions (#1996) Example: ?- countall(false, 0). true. --- src/lib/iso_ext.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/iso_ext.pl b/src/lib/iso_ext.pl index 0a5798ae..b6863487 100644 --- a/src/lib/iso_ext.pl +++ b/src/lib/iso_ext.pl @@ -370,7 +370,7 @@ countall(Goal, N) :- ( integer(N) -> ( N < 0 -> domain_error(not_less_than_zero, N, countall/2) - ; N > 0 + ; true ) ; true ), From 1967518fa2c5a1a625fc88f47a0f27e88f6e663d Mon Sep 17 00:00:00 2001 From: Markus Triska Date: Tue, 5 Sep 2023 19:42:55 +0200 Subject: [PATCH 2/2] FIXED: documentation of countall/2 (#1976) --- src/lib/iso_ext.pl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib/iso_ext.pl b/src/lib/iso_ext.pl index b6863487..2f1286f0 100644 --- a/src/lib/iso_ext.pl +++ b/src/lib/iso_ext.pl @@ -358,10 +358,10 @@ call_nth_nesting(C, ID) :- bb_put(ID, 0), bb_put(i_call_nth_counter, C). -%% countall(Goal, N). +%% countall(G_0, N). % -% countall(Goal, N) counts all solutions of Goal and unifies N with -% this number of solutions. This predicate always succeeds once. +% countall(G_0, N) is true iff N unifies with the total number of +% answers of call(G_0). :- meta_predicate(countall(0, ?)).