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
Here's a fairly simple and idiomatic Scala collections way to write it:
def rotateSeq[A](seq: Seq[A], isLeft: Boolean = false, count: Int = 1): Seq[A] = if (isLeft) seq.drop(count) ++ seq.take(count) else seq.takeRight(count) ++ seq.dropRight(count)