in reply to cross combinations

I'd hope that such things were lazy in Perl6. Doing combinatorial things by allocating them all in memory at once mostly sucks. In Perl5 I'd write an iterator. I'd hope Perl6 would support taking a list of lazy lists and "returning" a lazy list of lists (being able to take a lazy list of lazy lists and returning a lazy list of lazy lists would be even cooler).

- tye        

Replies are listed 'Best First'.
Re^2: cross combinations (lazy)
by revdiablo (Prior) on Oct 28, 2005 at 14:26 UTC
    I'd hope that such things were lazy in Perl6.

    As eric256 pointed out in Re^2: cross combinations, gather and take are indeed lazy in Perl 6. Some folks are angling to get that redacted as the default, but they also recognize how useful it will be in many cases, so their proposals include a simple, convenient way to turn laziness back on. In either event, I think the answer will be Yes. :-)

      Surely, precalculating the count of items to be returned defeats much of the point of being lazy?

      - tye        

        Certainly, but the point is that Perl 6 is going to make laziness possible and convenient, not that it will magically change unlazy algorithms to be such. I thought your comment was about Perl 6 more generally than the code in the OP, so my reply was intended to be more general as well. Sorry if there was any misunderstanding.

        Update: Re: tye's reply: explanation understood, but I don't really have any answers to his further questions.