Last active
December 19, 2015 19:48
-
-
Save mzimecki/6008387 to your computer and use it in GitHub Desktop.
[Scala] Many ways of passing x < 0 function into exists function (verbose version as first one). Each of them has the same meaning.
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 containsNeg1(nums: List[Int]) = nums.exists((x: Int) => x < 0) | |
def containsNeg2(nums: List[Int]) = nums.exists((x) => x < 0) | |
def containsNeg3(nums: List[Int]) = nums.exists(x => x < 0) | |
def containsNeg4(nums: List[Int]) = nums.exists(_ < 0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment