Skip to content

Instantly share code, notes, and snippets.

@JoolsF
Created November 19, 2016 17:09
Show Gist options
  • Select an option

  • Save JoolsF/6260244232aa347fcbc0a198806eb4c5 to your computer and use it in GitHub Desktop.

Select an option

Save JoolsF/6260244232aa347fcbc0a198806eb4c5 to your computer and use it in GitHub Desktop.
Method to function example
/**
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