Skip to content

Instantly share code, notes, and snippets.

@ajozwik
Created April 2, 2014 17:42
Show Gist options
  • Save ajozwik/9939158 to your computer and use it in GitHub Desktop.
Save ajozwik/9939158 to your computer and use it in GitHub Desktop.
def filterNot[A](ts: Seq[A])(p: (A) ⇒ Boolean): Seq[A] = {
val reverted = ts.foldLeft[Seq[A]](Seq()) {
(acc, el) => if (p(el)) acc else el +: acc
}
reverted.reverse
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment