Skip to content

Instantly share code, notes, and snippets.

@adz
Last active November 27, 2015 04:57
Show Gist options
  • Save adz/0d660064a9466716f400 to your computer and use it in GitHub Desktop.
Save adz/0d660064a9466716f400 to your computer and use it in GitHub Desktop.
function make_user(role, name, password) {
<some code that actually makes user>
}
//function make_user_with_role(role) {
// function make_user_for_given_role(name, password) {
// make_user(role, name, password)
// }
// return make_user_for_given_role;
//}
//
//... but if we could just use partial application (or use a curried function)... you could do this:
// make_admin = make_user_with_role(“admin”)
make_admin = _.partial(make_user, “admin”)
make_admin(“adz”, “pa$$word”)
make_admin(“rebecca” “$$ecret”)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment