|
||||||||||||
|
|
||||||||||||
ListsThere are two types of lists: tuples and lists. Tuple is an immutable list of values. It is created with parenthesis enclosing a list of expressions. To create a tuple with one element, there must be an extra comma after the single expression. A tuple with no elements is an empty parenthesis. A tuple yields a value of type anvil.lang.tuple. tuple-expr := "(" ")" tuple-expr := "(" expr "," ")" tuple-expr := "(" expr-list [","] ")" List is a mutable list of values. It is created with curly braces enclosing a list of expressions. In order to prevent ambiguity with block statements, a backlash is inserted before the opening brace. List yields a value of type anvil.lang.list. Lists can also be created using list compreshension, which will create a new list containing all the elements the yielded by the innermost expression inside comprehension. list-expr := "\{" expr-list [","] "}" list-ctor := "\{" comprehension-foreach "}" comprehension-foreach := "foreach" "(" ... ")" comprehension comprehension-if ::= "if" "(" expr ")" comprehension comprehension := comprehension-foreach | comprehension-if | expr
|
||||||||||||
|
|
||||||||||||