home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.compilers      Compiler construction, theory, etc. (Mod      2,753 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 1,909 of 2,753   
   Paul Biggar to Andy Walker   
   Re: Unnatural iteration [was: Testing st   
   23 Jun 10 17:12:11   
   
   From: paul.biggar@gmail.com   
      
   On Tue, Jun 22, 2010 at 12:18 PM, Andy Walker  wrote:   
   > B You have some   
   > items to process in order, so you write   
   >   
   > B  B  B  B FOR n := 1 TO nitems DO processitem (n) DONE   
   >   
   > What could be more natural?   
      
   I find this quite unnatural and inelegant, compared to some newer languages:   
      
   Python: for i in items: processitem(i)   
   Ruby: items.each { |i| processitem i }   
   Haskell: map processitem items   
      
   I don't see why there is a need for manually iterating through   
   anything. In the sample above, I had to quickly check whether there   
   was an off-by-one error.   
   --   
   Paul Biggar   
   paul.biggar@gmail.com   
   [We're getting close to the where-do-the-semicolons-go point of no   
   return. -John]   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca