August 27, 2024

P17 - Split a list into two parts.

The length of the first part is given.  Use a Tuple for your result.

Example:

scala

scala> split(3, List('a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, 'i, 'j, 'k))
res0: (List[Symbol], List[Symbol]) = (List('a, 'b, 'c),List('d, 'e, 'f, 'g, 'h, 'i, 'j, 'k))
Be first to comment
Leave a reply