Skip to content

Instantly share code, notes, and snippets.

@hoffination
Last active September 26, 2017 21:49
Show Gist options
  • Save hoffination/4711addc9a932454e9540c47f9afefb7 to your computer and use it in GitHub Desktop.
Save hoffination/4711addc9a932454e9540c47f9afefb7 to your computer and use it in GitHub Desktop.
Notes on Functional Programming with Ramda

Functional Programming

Data flows right-to-left in Ramda

R.map(R.add(1), [1,2,3]); // 2,3,4

Allows us to use shorthand to easily access attributes on an item

return getItems()
  .then(R.pluck('attr'));

Pipe comes in handy when you want to compose a series of functions together but want to organize them logically in left-to-right order

var getCostWithTax = R.pipe(
  R.prop('cost'), // get cost
  R.multiply(1 + TAX_RATE) // calculate tax
);

It doesn't look like pPipe made it into the current version of ramda...

A pretty solid introduction to functional programming concepts. I've already read a bit of the first couple chapters but could use a refresher on Currying, Pointfree, and Composition.

Chapter 4: Currying

Cool Links

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment