in reply to Variation on the "Higher Order Perl" Iterator Pattern

rjray,
You may be interested in Merge Algorithm (Combining Sorted Lists). In it, I provided a more generic (higher order) approach to fetching items from the lists.

You may also be interested in an article I wrote for perl.com on Understanding And Using Iterators.

Do you use iterators a lot at work? I once combined 4 different iterators to solve a problem and was wondering if anyone had ever used more. I am rather passionate about iterators because my brain seems to have a hard time thinking recursively.

Cheers - L~R

  • Comment on Re: Variation on the "Higher Order Perl" Iterator Pattern

Replies are listed 'Best First'.
Re^2: Variation on the "Higher Order Perl" Iterator Pattern
by runrig (Abbot) on Feb 08, 2008 at 20:52 UTC
    I wrote RFC: DBIx::Iterator because I needed to join over 20 tables in a database, but the schema was unknown...no one was quite sure how the tables were supposed to be joined exactly. So I did a lot of experimenting with joining and unjoining tables. In a normal SQL statement though, if you want to remove the table in a join, you have to remove the appropriate SELECT columns, the table in the FROM clause, and the appropriate parts of the WHERE clause. With the iterators I used, I could remove a join by commenting out one line (saving lots of time in the "experimenting" phase). So in a way, it was over 20 iterators joined together (though all the same type).
Re^2: Variation on the "Higher Order Perl" Iterator Pattern
by rjray (Chaplain) on Feb 08, 2008 at 20:01 UTC

    Not a lot, at least not any more than any other given structure. That may change in the future, as we're in the midst of some hard-core refactoring. We have several petabytes of data in MySQL tables, some of which have to be split across physical drives (if not physical machines) due to sheer volume.

    --rjray