Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Blog - Achieving point-free JavaScript - introducing point-free style programming
// From https://github.com/MostlyAdequate/mostly-adequate-guide/blob/master/ch5.md#pointfree
// Not point-free because we mention the data: name
let initials = (name) => name.split(' ').map(compose(toUpperCase, head)).join('. ');
// Point-free style
let initials = compose(
join('. '),
map(compose(toUpperCase, head)),
split(' ')
);
initials("hunter stockton thompson");
// 'H. S. T'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.