Jump to content

Currying: Difference between revisions

Added Kotlin
m (https://github.com/dlang/phobos/pull/1979)
(Added Kotlin)
Line 861:
 
We can now use plus5 as a filter, e.g.<lang jq>3 | plus5</lang> produces 8.
 
=={{header|Kotlin}}==
<lang scala>// version 1.1.1
 
fun curriedAdd(x: Int) = { y: Int -> x + y }
 
fun main(args: Array<String>) {
val a = 2
val b = 3
val sum = curriedAdd(a)(b)
println("$a + $b = $sum")
}</lang>
 
{{out}}
<pre>
2 + 3 = 5
</pre>
 
=={{header|LFE}}==
9,492

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.