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. In LMNtal, all numbers are unary (i.e., one-argument) atoms.

Syntax by examples

X = -2, p(345)
X = 2.0, p(-3.14e-10)

Operations

The following operations are provided by built-in rules. For example, +(3,5,X) (or X=3+5) will be reduced to 8(X) (or X=8).

int(+Float,-Int)           - cast
float(+Int,-Float)         - cast
'+'(+Int,+Int,-Int)        - integer operation,  as well as: -, *, /, mod
'+.'(+Float,+Float,-Float) - floating operation, as well as: -., *., /.

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")
p([:abc\de"
fg:])

The argument in the second example is in C-like format and the argument in the third example is in 'multiline-quoted format', expressing the same string. The literal [::] expresses an empty string ("").

Operations

Operations on strings are supported by the library API (str module).


Reload   New Edit Freeze Diff Upload Copy Rename   Front page List of pages Search Recent changes Backup   Help   RSS of recent changes
Last-modified: 2017-03-02 (Thu) 03:32:49 (115d)