Call a function: Difference between revisions
Content added Content deleted
m (minor edit to formatting of Scala section) |
m (small edit to partial application examples) |
||
Line 2,010: | Line 2,010: | ||
def divide(top: Double, bottom: Double) = top / bottom |
def divide(top: Double, bottom: Double) = top / bottom |
||
val div = (divide _) |
val div = (divide _) // partial application -- defer application of entire arg list |
||
val |
val halve = divide(_: Double, 2) // partial application -- defer application of some arguments |
||
class Foo(var value: Int) |
class Foo(var value: Int) |