Compile the atomic first argument to a Prolog clause and unify the new clause with the second argument. It is not necessary that the atomic term is ended by a dot character, for instance the atoms 'a' and 'a.' will both produce the same term.
If the atom to compile contains syntax errors then a syntax_error/1 exception is thrown, the Trinc-Prolog IDE also displays all the generated error messages. All other Trinc-Prolog applications like the DLL ignore the error messages and only throw an exception. Warnings are like a warning for 'singleton variables' are all ignored and processing of get_term/2 will continue.
see also: arg/3 copy_term/2 freeze/2 functor/3 melt/3 number_vars/3 =../2
| Example | |
| get_term('a', B). | Succeeds because the atom 'a' was successfully compiled and
unified with the empty variable B, B = a |
| B=a, get_term('a(sd).', B). | fails because the compiled clause 'a(sd)' cannot be unified with the value of the variable B which is 'a'. |
| Exceptions | |
| The first argument Arg is not an atom | a type_error(atom, Arg) exception is thrown |
| The atom to compile contains a syntax error | a syntax_error('error in clause') exception is thrown |