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 is one liner solution
def rotateRight(A: Array[Int], K: Int): Array[Int] = { if (null == A || A.size == 0) A else (A drop A.size - (K % A.size)) ++ (A take A.size - (K % A.size)) } rotateRight(Array(1,2,3,4,5), 3)