Last active
July 17, 2019 17:13
-
-
Save kutyel/29ba74cd6bc4af77f63685d59139fd6b to your computer and use it in GitHub Desktop.
Flavio's functional programming test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Implement the following classic FP functions using | |
* _only_ Array.prototype.{reduce|reduceRight}(). 🤓 | |
*/ | |
const filter = f => xs => xs | |
const map = f => xs => xs | |
const every = f => xs => xs | |
const some = f => xs => xs | |
const flatMap = f => xs => xs | |
const find = f => xs => xs | |
const findIndex = f => xs => xs | |
const reverse = xs => xs | |
/* | |
* Bonus! 👾 | |
*/ | |
const compose = (...fns) => args => args | |
const pipe = (...fns) => args => args |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment