Skip to content

Instantly share code, notes, and snippets.

@juliangruber
Last active August 29, 2015 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save juliangruber/8819271 to your computer and use it in GitHub Desktop.
Save juliangruber/8819271 to your computer and use it in GitHub Desktop.
co-stream pipe example
function pipe(){
var streams = [].slice.call(arguments);
return streams.slice(1).reduce(function(acc, stream){
return stream(acc);
}, streams[0]);
}
// usage:
var read = pipe(a(), b(), c(), d());
// which is the same as:
var read = d(c(b(a())));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment