YAP 7.1.0
call_count/3

call_count(? CallsMax, ? RetriesMax, ? CallsAndRetriesMax) More...

Detailed Description

call_count(? CallsMax, ? RetriesMax, ? CallsAndRetriesMax)

Set call counters as timers YAP will generate an exception if one of the instantiated call counters decreases to 0:

  • CallsMax

    throw the exception call_counter when the counter calls reaches 0;

  • RetriesMax

    throw the exception retry_counter when the counter retries reaches 0;

  • CallsAndRetriesMax

    throw the exception call_and_retry_counter when the counter calls_and_retries reaches 0

    YAP will ignore counters that are called with unbound arguments

Next, we show a simple example of how to use call counters:

?- prolog_flag(call_counting,on), [-user]. :- . . yap_flag(call_counting,off).
yap_flag
yap_flag
?- catch((call_count(10000,_,_),l),call_counter,format("limit_exceeded.~n",[])).
catch.
catch
catch( : Goal,+ Exception,+ Action)
yap_flag( ?Param, ?Value)

Notice that we first compile the looping predicate l/0 with call_counting on Next, we catch/3 to handle an exception when l/0 performs more than 10000 reductions

Definition at line 1 of file callcount.yap.


The documentation for this class was generated from the following file: