Functions using *wait*, *!* and *<-* are specially compiled. 

   1. function F1$_(){
   2. var randPrintNums$;
   3. randPrintNums$ = async$({build:function(SCHEMATA$_){return 
   function(n$){
   4. var T1$_, T8$_, T9$_;
   5. var i$, tasks$;
   6. function block_T2(T2$_){
   7. tasks$ = [];
   8. for(((i$ = 0), (T1$_ = n$)); i$ < T1$_; (i$ = i$ + 1)){
   9. (function F3$_(){
   10. var index$;
   11. index$ = i$;
   12. return tasks$.push(async$({build:function(SCHEMATA$_){return 
   function(){
   13. var T4$_, T5$_;
   14. function block_T3(T3$_){
   15. T4$_ = (sleep$);
   16. T5$_ = ((100 * Math$.random()));
   17. return SCHEMATA$_.yield(T4$_(T5$_,block_T6));
   18. };
   19. function block_T6(T6$_){
   20. T6$_;
   21. trace$(index$);
   22. return SCHEMATA$_["return"]();
   23. };
   24. return block_T3;
   25. }}}));
   26. }());
   27. };
   28. T8$_ = (join$);
   29. T9$_ = (tasks$);
   30. return SCHEMATA$_.yield(T8$_(T9$_,block_Ta));
   31. };
   32. function block_Ta(Ta$_){
   33. Ta$_;
   34. return SCHEMATA$_["return"]();
   35. };
   36. return block_T2;
   37. }}});
   38. randPrintNums$(100);
   39. }


在 2012年4月26日星期四UTC+8下午8时32分50秒,Oliver Leics写道:
>
> On Thu, Apr 26, 2012 at 2:27 PM, Belleve Invis <[email protected]> 
> wrote: 
> > Code Example 
> > 
> > def async randPrintNums(n): 
> >     def tasks = [] 
> >     for(var i in 0..n) 
> >         tasks.push async :> 
> >             wait sleep (100 * Math.random()) 
> >             trace index 
> >         where index = i 
> >     wait join tasks 
> > 
> > randPrintNums 100 
>
> What is the resulting JavaScript? 
>

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to