Partial function application: Difference between revisions

→‎{{header|Kotlin}}: Updated example see https://github.com/dkandalov/rosettacode-kotlin for details
(→‎{{header|Kotlin}}: Updated example see https://github.com/dkandalov/rosettacode-kotlin for details)
Line 1,188:
 
=={{header|Kotlin}}==
<lang scala>// version 1.1.12
 
typealias Func = (Int) -> Int
Line 1,195:
fun fs(f: Func, seq: List<Int>) = seq.map { f(it) }
 
fun partial(fs: FuncS, f: Func) = { seq: List<Int> -> fs(f, seq) }
 
fun f1(n: Int) = 2 * n
Line 1,201:
fun f2(n: Int) = n * n
 
fun main(args: Array<String>) {
val fsf1 = partial(::fs, ::f1)
val fsf2 = partial(::fs, ::f2)