Skip to content

Instantly share code, notes, and snippets.

@emanchado
Created August 28, 2011 08:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save emanchado/1176395 to your computer and use it in GitHub Desktop.
Save emanchado/1176395 to your computer and use it in GitHub Desktop.
Example of how to use higher order functions in Scala
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