Macro swipl_macros::pred
source · pred!() { /* proc-macro */ }
Expand description
Generate an inline callable predicate.
Predicates are specified in prolog style. You can either use the
syntax predicate/arity
or module:predicate/arity
.
This macro will generate code that generates a CallablePredicate
object. The actual prolog predicate is only looked up at first
call of this generated code. Each subsequent call will reuse the
lookup.
example:
ⓘ
let writeq = pred!(writeq/1);
context.call_once(writeq, [&term])?;
ⓘ
context.call_once(pred!(user:nl/0), [])?;