QP_unify()

Synopsis

     #include <quintus/quintus.h>
     
     int QP_unify(term1, term2)
     QP_term_ref term1;
     QP_term_ref term2;
     

Unify two Prolog terms.

Description

QP_unify() unifies the two terms referenced by term1 and term2. Both should be initialized references. If the unification succeeds, the function returns QP_SUCCESS, otherwise it returns QP_FAILURE. If the unification results in any bindings then the bindings are trailed. If Prolog backtracks over the foreign function that called QP_unify() then the bindings are undone.

Examples

c_unify(term1, term2) is equivalent to the usual Prolog builtin =/2, but it returns a third argument, which is an integer indicating success or failure.

                                     
foo.pl
foreign(c_unify, c, c_unify(+term, +term, [-integer])).
                                      
foo.c
#include <quintus/quintus.h> long int c_unify(t1, t2); QP_term_ref t1, t2; { return QP_unify(t1, t2); }

See Also

=/2