Another update from ingydotnet^djgoku
This commit is contained in:
parent
91df62d461
commit
948b86eafa
7604 changed files with 108452 additions and 22726 deletions
9
Task/Y-combinator/JavaScript/y-combinator-7.js
Normal file
9
Task/Y-combinator/JavaScript/y-combinator-7.js
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
let
|
||||
polyfix= // A version that takes an array instead of multiple arguments would simply use l instead of (...l) for parameter
|
||||
(...l)=>(
|
||||
(f=>f(f))
|
||||
(g=>l.map(f=>(...x)=>f(...g(g))(...x)))),
|
||||
[even,odd]= // The new destructive assignment syntax for arrays
|
||||
polyfix(
|
||||
(even,odd)=>n=>(n===0)||odd(n-1),
|
||||
(even,odd)=>n=>(n!==0)&&even(n-1));
|
||||
Loading…
Add table
Add a link
Reference in a new issue