From c922ed8b0abbbc65e4a2b25f289da655190daaf1 Mon Sep 17 00:00:00 2001 From: Aleksy Grabowski Date: Fri, 6 Sep 2024 08:15:45 +0200 Subject: [PATCH 1/2] Explain non_counted_backtracking a little bit more --- src/lib/iso_ext.pl | 1 + src/lib/ops_and_meta_predicates.pl | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/lib/iso_ext.pl b/src/lib/iso_ext.pl index 3eb00a3e..5c779b10 100644 --- a/src/lib/iso_ext.pl +++ b/src/lib/iso_ext.pl @@ -223,6 +223,7 @@ run_cleaners_without_handling(Cp) :- %% call_with_inference_limit(Goal, Limit, Result). % % Similar to `call(Goal)` but it limits the number of inferences for each solution of Goal. +% Calls to it may be nested, but only the last limit will be in power. call_with_inference_limit(G, L, R) :- ( integer(L) -> ( L < 0 -> diff --git a/src/lib/ops_and_meta_predicates.pl b/src/lib/ops_and_meta_predicates.pl index 929165e3..d4f67671 100644 --- a/src/lib/ops_and_meta_predicates.pl +++ b/src/lib/ops_and_meta_predicates.pl @@ -5,9 +5,13 @@ :- op(1199, fx, meta_predicate). -/* this is an implementation specific declarative operator used to implement call_with_inference_limit/3 - and setup_call_cleanup/3. switches to the default trust_me and retry_me_else. Indexing choice - instructions are unchanged. */ +% Declarative operator used to implement `call_with_inference_limit/3` and +% `setup_call_cleanup/3`. Compiler switches to the default trust_me, retry_me_else +% and some other instructions for all predicates the marked with it. Indexing +% choice instructions are unchanged. +% +% Default instructins are not subject to inference counting, so their execution +% will not be considered if they happen to be called by `call_with_inference_limit/3`. :- op(700, fx, non_counted_backtracking). % arithmetic operators. From 4b0f9558b33922319917b160bd41e383641d8be7 Mon Sep 17 00:00:00 2001 From: Aleksy Grabowski Date: Sat, 7 Sep 2024 08:22:47 +0200 Subject: [PATCH 2/2] Change wording for non_counted_backtracking comment --- src/lib/ops_and_meta_predicates.pl | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/lib/ops_and_meta_predicates.pl b/src/lib/ops_and_meta_predicates.pl index d4f67671..8f904d63 100644 --- a/src/lib/ops_and_meta_predicates.pl +++ b/src/lib/ops_and_meta_predicates.pl @@ -5,13 +5,16 @@ :- op(1199, fx, meta_predicate). -% Declarative operator used to implement `call_with_inference_limit/3` and -% `setup_call_cleanup/3`. Compiler switches to the default trust_me, retry_me_else -% and some other instructions for all predicates the marked with it. Indexing -% choice instructions are unchanged. +% Implementation specific declarative operator used to implement +% call_with_inference_limit/3 and setup_call_cleanup/3. Compiler switches +% to the default trust_me, retry_me_else and some other instructions for all +% predicates that are marked with it. Indexing choice instructions are unchanged. +% +% Implementation details: +% Default instructions are not subject to inference counting, so their +% execution will not be considered if they happen to be called by +% call_with_inference_limit/3. % -% Default instructins are not subject to inference counting, so their execution -% will not be considered if they happen to be called by `call_with_inference_limit/3`. :- op(700, fx, non_counted_backtracking). % arithmetic operators.