Continuation

https://github.com/eu81273/jsfiddle-console

by dimitrs_papadimitriou

HTML

<script src="https://rawgit.com/eu81273/jsfiddle-console/master/console.js"></script>

JavaScript

var ContM=function  ()   { 
this.toCont = function (v){
 this.continuation  = (callback=>callback(v));
}
this.bind = function (func){
return new ContM().toCont(c=>        this.continuation(contResult=>func(contResult)(c)));
} 


}




new ContM().toCont(x=>x*x).bind( (y=>new ContM().toCont(y(4).bind(
     					(t=>console.log(t))))));