Re: foreach routine

new topic     » goto parent     » topic index » view thread      » older message » newer message

Derek Parnell wrote:
> 
> duke normandin wrote:
> > 
> > Hi...
> > 
> > Where are we at on this issue? 
> 
> Here is a first cut at an interim solution...
> }}}
<eucode>
> -- foreach.e

[snip and saved] 

Nice Code! and well documented! The Euphoria community may just put you in
the Hall-of-Fame you know ;)

Like I said in another post, I basically trying to emulate Perl's `foreach'
routine, as in:
     foreach $pair (@pairs){
        do something
     }

where @pairs is a simple array (no sweat! => a "U4ia" sequence)
      $pair is a variable used in "list" context so it gets a string

So in Perl, what happens here is that the foreach routine is fed an array
(sequence), it walks through it and returns each element one at a time.
This element gets shoved into $pair (in this example). $pair is then
massaged whichever way you need.

In Lua, they have `foreach' to walk through a hash, and `foreachi' to walk
through an "indexed" array. Slick too!
--
duke

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu