# Syntax Extensions
# Nested Lists
Normally a list in Arden Syntax is flat, i.e., it may not contain lists. However, in some special cases, nested lists are allowed, or even required.
Type | Description |
---|---|
Argument assignment | The argument element may contain nested lists, e.g., a collection of ss records and fields from a database. Example: input := ARGUMENT; |
Read statement | The result of a read statement may also be a nested list. Example: res := READ { read_key_res }; |
Call statement | Each operand of called modules (MLMs, events, or interfaces) can be lists, and thus packed together as a nested list. The result may be a nested list as well Example: res := CALL module1 WITH arg1, arg2; |
Return statement | Analogous to call statements, the arguments of a return statement may also be lists, and therefore combined to a nested list. Example: RETURN res1, (res2_1, res2_2), res3; |
Within this documentation, "nested lists" are referred to as "compound lists" and are only allowed in the aforementioned four scenarios, but have implications for the syntax. In all other list use cases, lists are assumed to be flat, and the use of compound lists is not allowed.
# Incoming Values
# General Compound List Handling
Inside a read
statement, the <mapping>
may return a compound list.
Therefore, all operators which are possible in the <constraint>
or
<aggregation>
part of the statement must be able to handle such
compound lists.
According to the Arden Syntax definition (Section 9.7) for the
<constraint>
part, these are:
Occur [not] Equal
Occur [not] Within ... To
Occur [not] Within ... Preceding
Occur [not] Within ... Following
Occur [not] Within ... Surrounding
Occur [not] Within Past
Occur [not] Within Same Day As
Occur [not] Before
Occur [not] After
Occur [not] At
The <aggregation>
part may contain the following operators, so they
also have to handle compound lists:
exist
sum
average
avg
minimum
min
maximum
max
last
first
earliest
latest
minimum ... from
min ... from
max ... from
maximum ... from
last ... from
first ... from
earliest ... from
latest ... from
All aforementioned operators accept compound lists as parameters.
Example:
FIRST 2 FROM ((1,2,3),(4,5,6),(7,8,9));
results in
((1,2),(4,5),(7,8))
# Assignment
For incoming values via the special variable ARGUMENT
, a READ
statement, or a CALL
statement, the situation is more complex. Its
value may contain a single value, a flat list, or a compound list. The
Arden Syntax definition does not describe how the assignment of such
values has to be done. The following cases have to be distinguished
(parentheses denote flat lists, parentheses with an exclamation point
denote compound lists):
Variable | Expression | Result |
---|---|---|
inp | 1 | inp := 1; |
inp | () | inp := (); |
inp | (1) | inp := (1); |
inp | (1, 2) | inp := (1, 2); |
inp | (!) | inp := null; |
inp | (!1) | inp := 1; |
inp | (! (1, 2) ) | inp := (1, 2); |
inp | (!1, 2) | inp := (!1, 2); |
(inp1, inp2) | 1 | inp1 := 1; inp2 := null; |
(inp1, inp2) | () | inp1 := null; inp2 := null; |
(inp1, inp2) | (1) | inp1 := 1; inp2 := null; |
(inp1, inp2) | (1, 2) | inp1 := 1; inp2 := 2; |
(inp1, inp2) | (!) | inp1 := null; inp2 := null; |
(inp1, inp2) | (!1) | inp1 := 1; inp2 := null; |
(inp1, inp2) | (! (1, 2)) | inp1 := (1, 2); inp2 := null; |
(inp1, inp2) | (!1, 2) | inp1 := 1; inp2 := 2; |