Last active
August 29, 2015 14:04
-
-
Save knubie/5227b77846bc260da79b to your computer and use it in GitHub Desktop.
Partial application
This file contains hidden or 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
# Without partial application. | |
ajax.get('url', (data) -> | |
map data, (item) -> | |
replace item, /_/g, '-' | |
# With partial application. | |
ajax.get('url', map(replace(/_/, '-'))) | |
#======================================== | |
# Without partial application. | |
firstTwo = (words) -> | |
map words, (word) -> | |
first word, 2 | |
# With partial application. | |
firstTwo = map(first(2)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment