August 27, 2024
P18 - Extract a slice from a list.
Given two indices, II and KK, the slice is the list containing the elements from and including the IIth element up to but not including the KKth element of the original list. Start counting the elements with 0.
Example:
scala
scala> slice(3, 7, List('a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, 'i, 'j, 'k))
res0: List[Symbol] = List('d, 'e, 'f, 'g)