Created
August 28, 2011 08:06
-
-
Save emanchado/1176395 to your computer and use it in GitHub Desktop.
Example of how to use higher order functions 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
object BmApp { | |
def bm(message: String, func: () => Unit) { | |
val start = System.currentTimeMillis() | |
func() | |
printf("%s: %d\n", message, System.currentTimeMillis() - start) | |
} | |
def main(args: Array[String]) { | |
bm("Testing Bench", () => Thread.sleep(1000)) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment