-
-
Save Aitozi/c257ae328b7822dfe87024ee87b0db4b to your computer and use it in GitHub Desktop.
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 exists(p: A=> Boolean): Boolean = this match { | |
case Cons(h, t) => p(h()) || t().exists(p) | |
case _ => false | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment