## Built-in Types †

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.

### Numbers †

Integer arithmetics and floating-point number arithmetics are available. It is important to note that all numbers are unary (i.e., one-argument) atoms. This is because, in most applicatinos, numbers are linked from other atoms representing larger expressions, data structures, processes, etc. In order to represent a (multi)set of numbers, the standard technique is to use a unary atom (san 'n' in the example below) holding each element.

#### Syntax by examples †

```X = -2
factorial(10, result)
p(-3.14e-10)
{n(2), n(3), n(5), n(7)}```

#### Operations †

There are two ways of performing arithmetic operations:

1. as explicit rewriting of arithmetic expressions and
2. as operations in the guard of rewrite rules.

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 †

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.

#### Syntax by examples †

```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 †

Operations on strings are supported by the string library API.

Last-modified: 2019-06-28 (Fri) 02:43:39 (169d)