Next: , Previous: , Up: Syntax [Contents][Index]


4.2 Data constants - the atomic term values

These are atoms (atom type), natural numbers (nat type), integers (int type), floating point numbers (num type) and strings (string type).

QuLog strings are not lists of byte codes as in Prolog. They are packed sequences of byte codes as in Python and are stored on the heap and are garbage collected when no longer referenced. Identity of strings is determined by character by character matching if they have the same length. Manipulation of strings - concatenation and sub-string extraction involves copying but is quite fast.

As in Prolog, QuLog atoms are stored in an atom table and are replaced by a pointer to its entry in the atom table. Identity of atoms is then identity of atoms table addresses, there is no character by character matching at runtime. Atoms are a suitable alternative to strings for character sequence values that will not be manipulated and are not transient values. For example use them for names of things in facts. The atom table entries are not garbage collected.

All data constants are sub-types of the system type atomic.

nat is a sub-type of int, which is a sub-type of num

On This Site