The currently supported built-in types are integers, floating point numbers, and strings. Some other data types (e.g., arrays) are supported by library API.
Integer arithmetics and floating-point number arithmetics are available. It is important to note that, in LMNtal, all numbers are unary (i.e., one-argument) atoms.
X = -2, p(345) X = 2.0, p(-3.14e-10)
There are two ways of performing arithmetic operations:
Here we describe the first approach that is provided by built-in rules '''that are enabled when the --use-builtin-rule option is provided'. With the --use-builtin-rule'' option, '+'(3,5,X) (that can be written also as X=3+5) will be reduced to 8(X) (or X=8). The following operations are available and can be written as binary operators, where + stands for operands and - stands for the result of operations.
'+'(+L,+M,-N) - integer addition, similarly for: -, *, /, mod '+.'(+A,+B,-C) - floating-point addition, similarly for: -., *., /.
Arithmetic operations can also be specified in the Guards of rules, in which case the operations are performed as part of reduction. See Guards for further details.
Strings (such as "abc") are unary atom names that are distinguished from ordinary symbols (such as 'abc' or just abc). String literals are treated as strings only if they are unary; otherwise, they are treated as ordinary symbols.
X = "abc" p("abc\\de\"\nf\ g")
The argument in the second example is in a C-like format.
LMNtal provides another quoted format enclosed by [: and :] like
p([:abc\de" fg:])
This represents an multi-line symbolic atom name rather than a string.
Operations on strings are supported by the library API (str module).