Library Reference
Note: the LMNtal API is under development and its specification
is subject to change.
In the following, arguments with the '+' sign are those consumed upon
reaction with the library atoms, while arguments with the '-' sign are
those generated by the library API. The slash (/) notation is used to
indicate the arity of atoms.
Library nlmem
The library nlmem (nonlinear membrane) contains an implementation of
the following rule schemes that use aggregates:
R=nlmem.copy(X,a), {$p[X|*Z]} :-
R=copied(X1,X2),
{$p[X1|*Z1]}, {$p[X2|*Z2]},
a(*Z1,*Z2,*Z).
nlmem.kill(X,b), {$p[X|*Z]} :- b(*Z).
They are rule schemes in the sense that a and b are metasymbols to be replaced by any symbolic names.
- nlmem.copy(+{P},+a,-R)
- An abbreviated form of
(nlmem.copy(R0,a,R), {+R0,P}).
Creates two copies of the
cell {+R0,P} with all its free links renamed, and
connects R and the two fresh copies of R0 using
a ternary atom with the name a.
Furthermore, for each free link L of the original cell
{+R0, P} (except R0 that will disappear together with the '+'), nlmem.copy
connects the two fresh copies of L and
the original L via the ternary atom a.
- nlmem.copy(+{P},-R)
- Same as {nlmem.copy({P},copied,R).
- nlmem.kill(+{P},+b)
- An abbreviated form of
(nlmem.kill(R0,b), {+R0,P}).
Connects each free link L of the cell
{+R0, P} (except R0 that will disappear together with the '+') to the unary atom b.
- nlmem.kill(+{P})
- Same as nlmem.kill({P},killed).
Library io (SLIM)
Input/output in SLIM is done through ports. An operation on
a port will return a new port to be used for future operations on the port.
- io.stdin(-RetRort)
- Returns a standard input port.
- io.stdout(-RetRort)
- Returns a standard output port.
- io.read_line(+Port,-RetRort,-Str)
- Read a single line Str from the input
port Port and returns a new port RetRort.
- io.read_char(+Port,-RetRort,-C)
- Read a character C from the input
port Port and returns a new port RetRort.
- io.read_token(+Port,-RetRort,-S)
- Read a token S separated by a space or newline from the input port Port and returns a new port RetRort.
- io.close_port(+Port,-RetRort)
- Close Port and returns it as RetRort.
Further operations on the port will cause an error.
- io.free_port(+Port)
- Frees Port.
- io.print_char(+Port,+C,-RetRort)
- Print a character C or an atom name C to Port and return a new port RetRort.
- io.print(+Port,+Str,-RetRort)
- Print a string Str to Port and
return a new port RetRort.
- io.print_newline(+Port,-RetRort)
- Print a newline to Port and
return a new port RetRort.
- io.print_line(+Port,+Str,-RetRort)
- Print a string Str and a newline
to Port and return a new port RetRort.
- io.print_mem(+Port,+M,-RetRort)
- Print the content of the membrane M
to Port and return a new port RetRort.
- io.open_output_string(-SRetRort)
- Creates a new string output port SRetRort.
- io.open_input_string(+Str,-SRetRort)
- Creates a new string input port
SRetRort consisting of the characters in the string Str.
- io.output_string(+Port,-RetRort,-Str)
- Dumps the current content of the string port Port to Str and returns the port as RetRort (without flushing it).