Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def chunk(start: Int, end: Int, line: String): Stream[String] = {
- def loop(i: Int, max: Int, chunks: List[String]): Stream[String] = i match {
- case i if i >= max => Stream()
- case i => chunks.sliding(i).map(_.mkString).toStream #::: loop(i+1, max, chunks)
- }
- loop(start, end, line.split(" ").toList)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement