Skip to content

Instantly share code, notes, and snippets.

@kretes
Created April 16, 2014 18:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kretes/10915969 to your computer and use it in GitHub Desktop.
Save kretes/10915969 to your computer and use it in GitHub Desktop.
def drop[T](n: Int, ts: Seq[T]): Seq[T] = {
def dropO[T](current: Int, ts: Seq[T]): Seq[T] = ts match {
case Nil => Nil
case head +: tail => if(current==0) dropO(n-1,tail) else head +: dropO(current-1,tail)
}
dropO(n-1,ts)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment