![]() |
|
Navigation |
Synopsis Compute a sublist of a list.
Function
list[&T] slice(list[&T] lst, int begin, int len)
Usage
import List;
Description Returns a sublist of
lst from index start of length len .
Examples
rascal>import List; ok rascal>slice([10, 20, 30, 40, 50, 60], 2, 3); list[int]: [30,40,50] rascal>slice(["zebra", "elephant", "snake", "owl"], 1, 2); list[str]: ["elephant","snake"] Questions
Question [1].
![]() ![]() slice(L, B, N) returns a list with:
Question [2].
![]() ![]()
Question [3].
![]() ![]() ![]() |