Skip to content

Instantly share code, notes, and snippets.

@PavelPenkov
Created March 9, 2011 14:10
Show Gist options
  • Save PavelPenkov/862241 to your computer and use it in GitHub Desktop.
Save PavelPenkov/862241 to your computer and use it in GitHub Desktop.
Array.prototype.map2 = function(f) {
return fold([], SynLib.append.combine(f));
}
Function.prototype.combine = function(g) {
return function() { this(g(arguments)) };
}
var SynLib = {
append: function(array, x) {
array.push(x);
return array;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment