Created
November 19, 2016 17:09
-
-
Save JoolsF/6260244232aa347fcbc0a198806eb4c5 to your computer and use it in GitHub Desktop.
Method to function example
This file contains hidden or 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
| /** | |
| A Scala method, as in Java, is a part of a class. It has a name, a signature, | |
| optionally some annotations, and some bytecode. | |
| A function in Scala is a complete object. | |
| */ | |
| def sizeConstraint(pred: IntPairPred, n: Int, text: String): Boolean = | |
| pred(text.size, n) | |
| val x: (IntPairPred, Int, Email) => Boolean = sizeConstraint _ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment