Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

From reading Odersky's book Scala's notion of currying functions i.e. f(x:Int)(y:Int) is differentiated from partially applied functions. Here is his currying example using a partially applied x():

def x(a:Int, b:Int) = a + b

val y = x(1, _:Int) // y is a partially applied function

y(2)

==========

Much better looking than his snippet:

def x(a:Int, b:Int) = a + b

def y = Function.curried(x _)(1)

y(2)



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: