next up previous contents index
Next: 1.17 Other Libraries Up: 1. Library Utilities Previous: 1.15 XSB Lint   Contents   Index

1.16 Miscellaneous Predicates

term_hash(+Term,+HashSize,-HashVal)
machine
Given an arbitrary Prolog term, Term, that is to be hashed into a table of HashSize buckets, this predicate returns a hash value for Term that is between 0 and HashSize -1.

pretty_print(+ClausePairs)
pretty_print
The input to pretty_print/1, ClausePairs, can be either a list of clause pairs or a single clause pair. A clause pair is either a Prolog clause (or declaration) or a pair:
(Clause,Dict)
Where Dict is a list of the form A = V where V is a variable in Clause and A is the string to be used to denote the variable 1.9.

By default, pretty_print/1 outputs atomic terms using writeq/1, but specialized output can be configured via asserting in usermod a term of the form

user_replacement_hook(Term,Call)
which will use Call to output an atomic literal $A$ whenever $A$ unifies with Term. For example, pretty printing weight constraints in XSB's XASP package is done via the hook
user_replacement_hook(weight_constr(Term),output_weight_constr(Term))
which outputs a weight constraint in a (non-Prolog) syntax that is used by several ASP systems.


next up previous contents index
Next: 1.17 Other Libraries Up: 1. Library Utilities Previous: 1.15 XSB Lint   Contents   Index
Terrance Swift 2007-10-06