A hook in XSB can be either a 0-ary predicate or a unary predicate. A 0-ary hook is called without parameters and unary hooks are called with one parameter. The nature of the parameter depends on the type of the hook, as described in the next subsection.
This predicate registers a hook; it must be imported from xsb_hook. HookSpec has the following format:
hook-type(your-hook-predicate(_))or, if it is a 0-ary hook:
hook-type(your-hook-predicate)For instance,
:- add_xsb_hook(xsb_assert_hook(foobar(_))).registers the hook foobar/1 as a hook to be called when XSB asserts a clause. Your program must include clauses that define foobar/1, or else an error will result.
The predicate that defines the hook type must be imported from xsb_hook:
:- import xsb_assert_hook/1 from xsb_hook.or add_xsb_hook/1 will issue an error.
Unregisters the specified XSB hook; imported from xsb_hook. For instance,
:- remove_xsb_hook(xsb_assert_hook(foobar(_))).As before, the predicate that defines the hook type must be imported from xsb_hook.