You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
varc=chan();go(function(){// async block});go(function(){// async block// parks if c empty!returntake(c,function(v){// called when v arrives on c});});go(function(){// async block// parks if c full!returnput(c,'hi!',function(){// optional// called when put successful});});
What can't we port from core.async?
varc=chan();vard=chan();// Real lifego(()=>{console.log('hi!');returntake(c,(x)=>{console.log(x);goput(d,x+1);gotake(d,(y)=>{console.log(y);});});});// If JS had macrosgo(()=>{console.log('hi');varx=take(c);console.log(x);put(d,x+1);vary=take(d);console.log(y);});
Can run thousands of async consumers at a time.