Skip to content

Instantly share code, notes, and snippets.

@diegopacheco
Created January 18, 2012 01:17
Show Gist options
  • Select an option

  • Save diegopacheco/1630172 to your computer and use it in GitHub Desktop.

Select an option

Save diegopacheco/1630172 to your computer and use it in GitHub Desktop.
Currying in Scala
def benchmark(msg:String)(f:()=>Unit) = {
val init = System.currentTimeMillis
f
val end = System.currentTimeMillis()
println(msg + " in: " + (end - init) + " ms")
}
benchmark("for benchmark ")( () =>
for(i <- 1 to 1000){
println(i)
})
// for benchmark in: 0 ms
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment