Re: repeat through hash
Jonathan Vanasco <[email protected]> Thu, 20 Apr 2006 20:29:57 -0400
| Newsgroups | gmane.comp.lang.perl.modules.petal |
|---|---|
| Message-ID | <[email protected]> |
On Apr 20, 2006, at 7:24 PM, Corey wrote: > Anyone in favor? Any pitholes or details I'm missing? Well there's this: in Perl, Python and PHP (the TAL implementations I use ), hashes ( perl hashes, python dicts , php named arrays ) are unordered. randomly showing items from a list, IMHO, is worthless and confusing. to do what you want, it would just be going randomly through the hash - you'd have to map some sort of sorting algorithm onto the function ( sort on the key? a value of hash element? what is the sort mechanism? ) i believe that in python you can map the repeat onto a generator or iterator - i *think* you can figure out a way mimic that it in perl using petal's method support ie, your repeat loop calls a function that returns the next item in whatever sequence, and petal stops doing that at the end its pretty easy to do in python tal, but i'm not sure about the petal version. i tried to stab away at the petal source and try to get nested variable to work. i don't think its quite possible. maybe some college student out there would want to do it through google summer of code? that would be awesome. | - - - - - - - - - - - - - - - - - - - - | RoadSound.com / Indie-Rock.net | Collaborative Online Management And Syndication Tools | - - - - - - - - - - - - - - - - - - - -