Navigation
Synopsis Pop top element from list, return a tuple.
Function tuple[&T, list[&T]] pop(list[&T] lst) throws EmptyList
Usage import List;
Description This function is identical to headTail. Also see push and top.
Examples
rascal>import List;
ok
rascal>pop([3, 1, 4, 5]);
tuple[int,list[int]]: <3,[1,4,5]>
rascal>headTail([3, 1, 4, 5]);
tuple[int,list[int]]: <3,[1,4,5]>
rascal>pop(["zebra", "elephant", "snake", "owl"]);
tuple[str,list[str]]: <"zebra",["elephant","snake","owl"]>

Questions
Question [1].
The type of pop(["Blueberry", "Pomegranate", "M", "Mandarin"]) is

Question [2].
pop(["Rosemary", "Raspberry"]) == 



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.