• Places
    • Home
    • Graphs
    • Prefixes
  • Admin
    • Users
    • Settings
    • Plugins
    • Statistics
  • Repository
    • Load local file
    • Load from HTTP
    • Load from library
    • Remove triples
    • Clear repository
    • RDF quality heuristics
  • Query
    • YASGUI SPARQL Editor
    • Simple Form
    • SWISH Prolog shell
  • Help
    • Documentation
    • Tutorial
    • Roadmap
    • HTTP Services
  • Login

4 The class PlTerm
AllApplicationManualNameSummaryHelp

  • Documentation
    • Reference manual
    • Packages
      • A C++ interface to SWI-Prolog
        • The class PlTerm
          • Constructors
          • Casting PlTerm to native C-types
          • Unification
          • Comparison
          • Analysing compound terms
          • Miscellaneous
          • The class PlString
          • The class PlCodeList
          • The class PlCharList
          • The class PlCompound
          • The class PlTail

4.3 Unification

int PlTerm::operator =(Type)
The operator = 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;
}

ClioPatria (version V3.1.1-40-g9d9e003)