Another update from ingydotnet^djgoku
This commit is contained in:
parent
91df62d461
commit
948b86eafa
7604 changed files with 108452 additions and 22726 deletions
1
Task/Currying/JavaScript/currying-2.js
Normal file
1
Task/Currying/JavaScript/currying-2.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
(a,b) => expr_using_a_and_b
|
||||
1
Task/Currying/JavaScript/currying-3.js
Normal file
1
Task/Currying/JavaScript/currying-3.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
a => b => expr_using_a_and_b
|
||||
23
Task/Currying/JavaScript/currying-4.js
Normal file
23
Task/Currying/JavaScript/currying-4.js
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
let
|
||||
fix = // This is a variant of the Applicative order Y combinator
|
||||
f => (f => f(f))(g => f((...a) => g(g)(...a))),
|
||||
curry =
|
||||
f => (
|
||||
fix(
|
||||
z => (n,...a) => (
|
||||
n>0
|
||||
?b => z(n-1,...a,b)
|
||||
:f(...a)))
|
||||
(f.length)),
|
||||
curryrest =
|
||||
f => (
|
||||
fix(
|
||||
z => (n,...a) => (
|
||||
n>0
|
||||
?b => z(n-1,...a,b)
|
||||
:(...b) => f(...a,...b)))
|
||||
(f.length)),
|
||||
curriedmax=curry(Math.max),
|
||||
curryrestedmax=curryrest(Math.max);
|
||||
print(curriedmax(8)(4),curryrestedmax(8)(4)(),curryrestedmax(8)(4)(9,7,2));
|
||||
// 8,8,9
|
||||
Loading…
Add table
Add a link
Reference in a new issue