Function composition: Difference between revisions
m
→{{header|Kotlin}}: made compose function generic
m (→{{header|Kotlin}}: made compose function generic) |
|||
Line 1,743:
=={{header|Kotlin}}==
<syntaxhighlight lang="
fun f(x: Int): Int = x * x
fun g(x: Int): Int = x + 2
fun <T, V, R> compose(f: (
fun main(
val x
println(compose(::f, ::g)(x))
}</syntaxhighlight>
|