Next: mpg-ref-integer, Previous: mpg-ref-initialization, Up: mpg-bpr [Contents][Index]
instance/2instance(+Ref, -Term)
Unifies Term with the most general instance of the dynamic clause or recorded term indicated by the database reference Ref.
db_reference, must be nonvar
term
Ref must be instantiated to a database
reference to an existing clause or recorded term. instance/2 is
not sensitive to the source module and can be used to access any
clause, regardless of its module.
instantiation_errorif Ref is not instantiated
type_errorif Ref is not a syntactically valid database reference
existence_errorif Ref is a syntactically valid database reference but does not refer to an existing clause or recorded term.
| ?- assert(foo:bar,R).
R = '$ref'(771292,1)
| ?- instance('$ref'(771292,1),T).
T = (bar:-true)
| ?- clause(H,B,'$ref'(771292,1)).
no
| ?- clause(foo:H,B,'$ref'(771292,1)).
H = bar,
B = true