Created
April 24, 2012 20:25
-
-
Save anderseriksson/2483422 to your computer and use it in GitHub Desktop.
filterNotFirst function in Scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def filterNotFirst(s: Seq[Any], v: Any): Seq[Any] = { | |
s.diff(Seq(v)) | |
} | |
assert(filterNotFirst(Seq(1,2,2,2,3), 2) == Seq(1,2,2,3)) | |
assert(filterNotFirst(Seq('a','a'), 'a') == Seq('a')) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment