Currying: Difference between revisions
Content added Content deleted
(added Ceylon) |
|||
Line 188: | Line 188: | ||
=={{header|C++}}== |
=={{header|C++}}== |
||
Currying may be achieved in [[C++]] using the [[wp:Standard Template Library|Standard Template Library]] function object adapters (<code>binder1st</code> and <code>binder2nd</code>), and more generically using the [[wp:Boost library|Boost]] <code>bind</code> mechanism. |
Currying may be achieved in [[C++]] using the [[wp:Standard Template Library|Standard Template Library]] function object adapters (<code>binder1st</code> and <code>binder2nd</code>), and more generically using the [[wp:Boost library|Boost]] <code>bind</code> mechanism. |
||
=={{header|Ceylon}}== |
|||
{{trans|Groovy}} |
|||
<lang ceylon>shared void run() { |
|||
function divide(Integer x, Integer y) => x / y; |
|||
value partsOf120 = curry(divide)(120); |
|||
print("half of 120 is ``partsOf120(2)`` |
|||
a third is ``partsOf120(3)`` |
|||
and a quarter is ``partsOf120(4)``"); |
|||
}</lang> |
|||
=={{header|Clojure}}== |
=={{header|Clojure}}== |