Synopsis Append an element at the end of a list
Syntax Exp1 + Exp2
Exp1 Exp2 Exp1 + Exp2
list[T1] T2 list[lub(T1,T2)]
Description The operator + appends an element at the end of a list. The + is one of those Operators which are overloaded. It can also mean List/Insert or List/Concatenation for example.
rascal>[] + 1;
list[int]: [1]
rascal>[1] + 2;
list[int]: [1,2]
  • If both operands of + are a list, then it acts as List/Concatenation This is concatenation:
    rascal>[1] + [2]
    list[int]: [1,2]
    To append a list to a list, use extra brackets:
    rascal>[1] + [[2]]
    list[value]: [

Question [1]. When you append an element to a list, the number of elements in the result is always:

Question [2].
The type of ["Darth Sidious", "V", "Musterd", "Little Bird"] + "Cardamon" is

Question [3].
["Obi-Wan Kenobi"] + "Bruno" == 

Is this page unclear, or have you spotted an error? Please add a comment below and help us to improve it. For all other questions and remarks, visit