Skip to content

Instantly share code, notes, and snippets.

@mrosata
Created November 19, 2016 16:08
Show Gist options
  • Select an option

  • Save mrosata/bfe818616bbbedd6e7b2f56c4d7c4082 to your computer and use it in GitHub Desktop.

Select an option

Save mrosata/bfe818616bbbedd6e7b2f56c4d7c4082 to your computer and use it in GitHub Desktop.
Getting Curried Away - example 1c - Full Gist at https://gist.github.com/mrosata/35e4d80c2b393267a4069fbf045e22a7
// Those 5 lines of code we wrote above to create more specific functions,
// is about the same as writing these 35 lines of code down here... power.
/* So to be clear, we don't have to write these implementations */
function farmhouse(creams, sugars) {
const coffee = getCoffee('farmhouse blend');
coffee.add.cream(creams);
coffee.add.suger(sugars);
return coffee;
}
function columbian(creams, sugars) {
const coffee = getCoffee('columbian');
coffee.add.cream(cream);
coffee.add.suger(sugar);
return coffee;
}
function arrrrrggg(creams, sugars) {
const coffee = getCoffee('half-caff carmel-mocha pumkin-karaoke');
coffee.add.cream(cream);
coffee.add.suger(sugar);
return coffee;
}
function farmhouseLight(sugars) {
const coffee = getCoffee('farmhouse blend');
coffee.add.cream(10);
coffee.add.suger(sugar);
return coffee;
}
function farmhouseBlack(sugars) {
const coffee = getCoffee('farmhouse blend');
coffee.add.cream(0);
coffee.add.suger(sugar);
return coffee;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment