Coder Social home page Coder Social logo

ramdatutorial's Introduction

Companion Source for Ramda Tutorial

"What's Ramda?"

Ramda is a Functional Programming library for JavaScript, that is simlar to Lodash and Underscore.

"What's different about Ramda vs. Lodash?"

Ramda follows many Functional Principles such as:

  • Functional Purity
  • Immutability
  • Currying
  • Composition

"Ok, big deal! Why should I care?"

There's many reasons, but if I had to give you one, I'd say: It provides a nice, simple way to build sophisticated logic through function composition.

"What's function composition?"

It's a way to create new functions by combining two or more pure functions. I like to think of it as creating new functions without having to add new logic.

"This seems interesting, where can I learn more?"

If Ramda and functional programming looks interesting, and you want to learn more, please consider taking my course "Functional Programming For Beginners with JavaScript"

ramdatutorial's People

Contributors

knowthen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

ramdatutorial's Issues

Slight impurity in `calcScore` function

Hi James, great series, I really enjoyed it. Was just wondering, and correct me if I'm wrong, but doesn't the calcScore function break the "Pure function rules" by relying externally on the constant groupedByProp ? This would need to be handed in as an argument, no?

ramdatutorial/index.js

Lines 39 to 54 in 8132dec

const groupedByProp = R.reduce(groupByPropReducer, {}, cities);
// console.log(groupedByProp);
const calcScore = city => {
const { cost = 0, internetSpeed = 0 } = city;
const costPercentile = percentile(groupedByProp.cost, cost);
const internetSpeedPercentile = percentile(
groupedByProp.internetSpeed,
internetSpeed,
);
const score =
100 * (1.0 - costPercentile) +
20 * internetSpeedPercentile;
return R.merge(city, { score });
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.