Created
October 9, 2017 01:23
-
-
Save baweaver/152e6a830c0813cd2d10bc1d05b41553 to your computer and use it in GitHub Desktop.
This file contains 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
const musicalEraAliveIn = (startLife, endLife) => { | |
const life = range(startLife, endLife); | |
const yearsAliveIn = compose(length, intersection(life)); | |
const largestBy = compose(nth(0), reverse, sortBy); | |
return largestBy(compose(yearsAliveIn, nth(1)), [ | |
['Medieval', range(476, 1400)], | |
['Renaissance', range(1400, 1600)], | |
['Baroque', range(1600, 1760)], | |
['Classical', range(1730, 1820)], | |
['Romantic', range(1815, 1910)], | |
['Modern', range(1900, 2100)] | |
])[0]; | |
}; | |
musicalEraAliveIn(1800, 1950); // => Romantic |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment