Last active
November 27, 2015 04:57
-
-
Save adz/0d660064a9466716f400 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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