Currying: Difference between revisions

217 bytes added ,  11 years ago
Added Common Lisp example
(→‎{{header|Perl 6}}: tagged as incorrect)
(Added Common Lisp example)
Line 33:
=={{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.
 
=={{header|Common Lisp}}==
<lang lisp>(defun curry (function &rest args-1)
(lambda (&rest args-2)
(apply function (append args-1 args-2))))
</lang>
 
Usage:
<lang lisp>
* (funcall (curry #'+ 10) 10)
 
20
</lang>
 
=={{header|D}}==
Anonymous user