I can do this quite easily, and cleanly, using a for loop. For instance, if I wanted to traverse a Seq from every element back to itself I would do the
Seq
Is it like below:
scala> def rotatedView(i:Int)=Seq(1,2,3,4,5).drop(i)++Seq(1,2,3,4,5).take(i) rotatedView: (i: Int)Seq[Int] scala> rotatedView(1) res48: Seq[Int] = List(2, 3, 4, 5, 1) scala> rotatedView(2) res49: Seq[Int] = List(3, 4, 5, 1, 2)