Partial function application: Difference between revisions
m
→JS ES6: Added subsections to ES6
m (→JS ES6) |
m (→JS ES6: Added subsections to ES6) |
||
Line 1,041:
===ES6===
====Simple curry====
<lang JavaScript>(() => {
'use strict';
Line 1,075 ⟶ 1,076:
{{Out}}
<pre>[[0, 2, 4, 6], [0, 1, 4, 9], [4, 8, 12, 16], [4, 16, 36, 64]]</pre>
====Generic curry====
The simple version of the higher-order '''curry''' function above works only on functions with two arguments. For more flexibility, we can generalise it to a form which curries functions with an arbitrary number of arguments:
|