Created
September 23, 2010 03:55
-
-
Save kriskowal/593065 to your computer and use it in GitHub Desktop.
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
return promises.reduce(function (accumulated, value) { | |
return Q.when(accumulated, function (accumulated) { | |
return Q.when(value, function (value) { | |
return accumulated + value; | |
}); | |
}); | |
}) |
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
Values: | |
[A,B,C,D,E,F,G] | |
Turns: | | | | | | | | |
| * | * | | * | |
* | | * | |
X | | | |
* | | |
X * | |
X | |
X | |
X | |
X | |
* is the resolution of a promise | |
X is a computation of the inner function |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I am lost. Do not know what the use case can be applied with this Gist.