Skip to main content




List values.


[ Exp₁, Exp₂, ... ]



Exp₁Exp₂...[ Exp₁, Exp₂, ... ]
T₁T₂...list[lub(T₁, T₂, ... )]


A list is an ordered sequence of values and has the following properties:

  • All elements have the same static type.
  • The order of the elements matters.
  • A list may contain an element more than once.

The type of a list has the form list[T], where T is an arbitrary type.

When a value or variable of type list occurs inside a list, that list value is inserted as list element. To achieve splicing of these elements, i.e., the insertion of the elements of the list value rather than the whole list, it has to be prefixed by the splice operator *.

The following operators are provided on list:

There are also library functions available for List.


rascal>[1, 2, 3];
list[int]: [1,2,3]
rascal>[<1,10>, <2,20>, <3,30>];
lrel[int,int]: [
rascal>[1, "b", 3];
list[value]: [1,"b",3]
rascal>[<"a",10>, <"b",20>, <"c",30>];
lrel[str,int]: [
rascal>[["a", "b"], ["c", "d", "e"]];
list[list[str]]: [

List splicing works as follows: by prefixing L by the splice operator, its elements are included as elements in the enclosing list:

rascal>L = [1, 2, 3];
list[int]: [1,2,3]
rascal>[10, L, 20];
list[value]: [
rascal>[10, *L, 20];
list[int]: [10,1,2,3,20]