Synopsis Take the top element of a list.
Function &T top(list[&T] lst) throws EmptyList
Usage import List;
Description This function is identical to head. Also see pop and push.
rascal>import List;
rascal>top([3, 1, 4, 5]);
int: 3
rascal>top(["zebra", "elephant", "snake", "owl"]);
str: "zebra"

Question [1].
The type of top([6, -3, -16, -13, 13, 14]) is

Question [2].
top([-18]) == 

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