Availability:built-in
call(Goal)
, but limits the number of
inferences
for each solution of Goal.73This
predicate was realised after discussion with Ulrich Neumerkel and Markus
Triska.. Execution may terminate as follows:
- If Goal does not terminate before the inference
limit is exceeded, Goal is aborted by injecting the exception
inference_limit_exceeded
into its execution. After termination of Goal, Result is unified with the atominference_limit_exceeded
. Otherwise, - If Goal fails, call_with_inference_limit/3 fails.
- If Goal succeeds without a choice point,
Result is unified with
.!
- If Goal succeeds with a choice point,
Result is unified with
true
. - If Goal throws an exception, call_with_inference_limit/3 re-throws the exception.
An inference is defined as a call or redo on a predicate. Please note that some primitive built-in predicates are compiled to virtual machine instructions for which inferences are not counted. The execution of predicates defined in other languages (e.g., C, C++) count as a single inference. This includes potentially expensive built-in predicates such as sort/2.
Calls to this predicate may be nested. An inner call that sets the limit below the current is honoured. An inner call that would terminate after the current limit does not change the effective limit. See also call_with_depth_limit/3 and call_with_time_limit/2.