Skip to content

Instantly share code, notes, and snippets.

@ppiotrow
Created October 30, 2013 19:20
Show Gist options
  • Save ppiotrow/7238530 to your computer and use it in GitHub Desktop.
Save ppiotrow/7238530 to your computer and use it in GitHub Desktop.
package pl.japila.scalania.s99
object S99_P19 {
def rotate[T](n: Int, ts: Seq[T]): Seq[T] = {
val k = if (n > 0) n else ts.length + n
val (l, r) = ts.splitAt(k)
r ++ l
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment