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
augment = (base, extra, context) -> | |
(-> | |
-> | |
base.apply context or this, arguments_ | |
extra.apply context or this, arguments_ | |
)() |
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
var augment = function (base, extra, context) { | |
return (function () { | |
return function () { | |
base.apply(context || this, arguments); | |
extra.apply(context || this, arguments); | |
}; | |
})(); | |
}; | |
// usage |
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
/* | |
example: | |
// [1,2,3,4,5,6,7,8] (must be a power of 2 length) | |
var arr = new Foldable([1, 2, 3, 4, 5, 6, 7, 8]); | |
arr.fold( [ "l", "r", "l" ] ); // left, right, left | |
// left |
NewerOlder