Created
September 13, 2017 04:18
-
-
Save outbreak/b18ea6ff5cdaf3f0741af1edb97c2fe4 to your computer and use it in GitHub Desktop.
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
// addTo :: HTML, HTML -> HTML | |
function addTo(container, html) { | |
$(container).append(html) | |
return container | |
} | |
// addAllTo :: HTML, [HTML] -> HTML | |
function addAllTo(container, htmls) { | |
htmls.map(function(html){ addTo(container, html) }) | |
return container | |
} | |
// Or, we can go use our Curry friend and make it better-er | |
var addTo = curry(2, addTo) | |
var addAllTo = curry(2, function(container, htmls) { | |
htmls.map(addTo(container)) | |
return container | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment