Did you know ... | Search Documentation: |
Unification |
=
is defined for the Types PlTerm,
long
, double
, char *
, wchar_t*
and
PlAtom. It performs Prolog
unification and returns TRUE
if successful and FALSE
otherwise.
The boolean return-value leads to somewhat unconventional-looking code as normally, assignment returns the value assigned in C. Unification however is fundamentally different to assignment as it can succeed or fail. Here is a common example.
PREDICATE(hostname, 1) { char buf[32]; if ( gethostname(buf, sizeof(buf)) == 0 ) return A1 = buf; return FALSE; }