Navigation
Synopsis Split a list in a head and a tail.
Function tuple[&T, list[&T]] headTail(list[&T] lst) throws EmptyList
Usage import List;
Description This function is identical to pop.
Examples
rascal>import List;
ok
rascal>headTail([3, 1, 4, 5]);
tuple[int,list[int]]: <3,[1,4,5]>
rascal>pop([3, 1, 4, 5]);
tuple[int,list[int]]: <3,[1,4,5]>
rascal>headTail(["zebra", "elephant", "snake", "owl"]);
tuple[str,list[str]]: <"zebra",["elephant","snake","owl"]>

Questions
Question [1].
The type of headTail([-19, 10, 14]) is

Question [2].
headTail([-17, -14, 12, 11, 16]) == 



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.