Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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