![]() |
|
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].
![]() ![]()
Question [2].
![]() ![]() ![]() |