Skip to content

Instantly share code, notes, and snippets.

@markmarch
Created February 24, 2012 18:01
Show Gist options
  • Save markmarch/1902437 to your computer and use it in GitHub Desktop.
Save markmarch/1902437 to your computer and use it in GitHub Desktop.
testing
def drop[T](list: List[T], n: Int): List[T] = {
@tailrec
def loop(l: List[T], n: Int): List[T] = l match {
case Nil => l
case _ if n == 0 => l
case x :: xs => loop(xs, n - 1)
}
loop(list, n)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment