Navigation
Synopsis Return all but the last element of a list.
Function list[&T] prefix(list[&T] lst)
Usage import List;
Examples
rascal>import List;
ok
rascal>prefix([3, 1, 4, 5]);
list[int]: [3,1,4]
rascal>prefix([]);
list[void]: []
rascal>prefix(["zebra", "elephant", "snake", "owl"]);
list[str]: ["zebra","elephant","snake"]

Questions
Question [1]. Takking the prefix of a list with N elements returns a list with





Question [2].
The type of prefix([false, false, true, false, false, true]) is

Question [3].
prefix(["Slimey the Worm", "Admiral Sarn", "Guava", "B", "Emperor Palpatine", "Date"]) == 



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 ask.rascal-mpl.org.