Did you know ... Search Documentation:
Pack pcache -- prolog/signature.pl
PublicShow source

This module is concerned with creating signatures for a predicate. The signature guarantees that neither the predicate itself, not one of its callees has changed. This is used to support persistent result caching.

 goal_signature(:Goal, -Term) is det
 goal_signature(:Goal, -Term, -Vars) is det
Replace the module and functor of Goal with a hash. For example,
user:between(1, 5, X),

becomes something like this:

'931be36e3ed89e766d332277a61664ff3c08d56a'(1, 5, X).

The hash is based on the predicate and predicates reachable though the call graph for the most generic form.

Arguments:
Vars- is a term holding the variables in Goal/Term (these are the same).
 deep_predicate_hash(:Head, -Hash) is det
Compute the predicate hash of Head and all its callees and combine this into a single hash.
To be done
- Could be faster by keeping track of the combined dependent hashes of predicates per module.
 hook_predicate_hash(:Head, -Hash) is semidet[multifile]
Hook that can be used to define the signature of a predicate. Hash must be an SHA1 hash key (see variant_sha1/2). Defining this hook has two effects:
  1. The predicate is claimed to have no dependencies. This in itself can be exploited to prune dependency tracking.
  2. The signature is Hash. A typical use case is a fact base that is derived from a file.
 predicate_dependencies(:Head, -Callees:list(callable)) is det
True when Callees is a set (ordered list) of all predicates that are directly or indirectly reachable through Head.
 sig_clean_cache is det
 sig_clean_cache(+M) is det
Cleanup cached signatures and dependencies. If a module is given, only the depedencies for the matching module are removed.

Undocumented predicates

The following predicates are exported, but not or incorrectly documented.

 goal_signature(Arg1, Arg2, Arg3)
 predicate_callees(Arg1, Arg2)
 sig_clean_cache(Arg1)