Skip to content

Instantly share code, notes, and snippets.

@nicoespeon
Last active April 11, 2016 21:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nicoespeon/d863696342119a70a97b654111249a7b to your computer and use it in GitHub Desktop.
Save nicoespeon/d863696342119a70a97b654111249a7b to your computer and use it in GitHub Desktop.
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