![]() |
|
Navigation |
Synopsis Get the tail element(s) from a list.
Function
Usage
import List;
Description
Examples All but first element:
rascal>import List; ok rascal>tail([10,20,30]); list[int]: [20,30]Try an error case: rascal>tail([]);
|rascal://List|(24027,958,<1194,0>,<1238,57>): EmptyList()
at *** somewhere ***(|rascal://List|(24027,958,<1194,0>,<1238,57>))
at tail(|stdin:///|(5,2,<1,5>,<1,7>))
Last n elements:
rascal>tail([10, 20, 30, 40, 50, 60], 3);
list[int]: [40,50,60]
Try an error case:
rascal>tail([10, 20, 30, 40, 50, 60], 10);
|rascal://List|(24988,115,<1240,0>,<1241,73>): IndexOutOfBounds(4)
at *** somewhere ***(|rascal://List|(24988,115,<1240,0>,<1241,73>))
at tail(|stdin:///|(31,2,<1,31>,<1,33>))
Questions
Question [1].
![]() ![]() tail(L, M) of a list with N (N > M ) elements returns a list with
Question [2].
![]() ![]()
Question [3].
![]() ![]() ![]() |