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
// Based on a discussion with Michael Haufe: | |
// https://groups.google.com/group/jsmentors/browse_thread/thread/d028fb0041f93a27 | |
// Not really recommended for anything but the fun of knowing it can be done! | |
var omega = function() { | |
var queue = []; | |
var valueOf = Function.prototype.valueOf; | |
Function.prototype.valueOf = function() { | |
queue.push(this); | |
return 1; // not needed now, but could be used later to distinguish operators. |
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 first = (function() { | |
var chainNames = ["then", "andThen", "next"]; | |
var endChainNames = ["finally", "andFinally", "last"]; | |
var chain = function(fn) { | |
var f1 = function(g) { | |
var func = function() {return g.call(this, fn.apply(this, arguments));}; | |
chain(func); | |
return func; | |
}; | |
var f2 = function(g) { |
NewerOlder