karelpeeters
02/26/2018, 7:59 AMAndreas Sinz
02/26/2018, 8:13 AMebonet
02/26/2018, 8:14 AMkarelpeeters
02/26/2018, 8:14 AMfun sum(a: Int, b: Int) = a + b
and then ::sum(3)
is a function reference with a
curried. Maybe even allow named parameters...Andreas Sinz
02/26/2018, 8:15 AMkarelpeeters
02/26/2018, 8:16 AMCurrying is related to, but not the same as, partial application.~Wikipedia Dammit, you can tell I'm not that into functional programming.
karelpeeters
02/26/2018, 8:17 AMAndreas Sinz
02/26/2018, 8:17 AMfun add(x: Int, y: Int) = x + y; val add5 = ::add(y = 5)
😄Andreas Sinz
02/26/2018, 8:24 AMkarelpeeters
02/26/2018, 8:25 AMAndreas Sinz
02/26/2018, 8:26 AMAndreas Sinz
02/26/2018, 8:29 AMmap
takes the function first and the list as second parameter, so you can apply the same function to multiple lists. in java/kotlin world the arguments are ordered how the library author wants it, so that could possibly render some functions being bad candidates for partial applications if you need to apply the second/third/whatever argument