object Functions {
def main(args :Array[String]) = {
println("rec: " + answer( basic ))
}
def basic(i : Int) : String = i.toString
def answer( f : Int => String ) = f.apply(42)
}
Sunday, 14 June 2009
Passing Functions to functions
Obviously unlike java 'basic' is not executed until in the function 'answer'.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment