in reply to Re: cross combinations (lazy)
in thread cross combinations

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. :-)

Replies are listed 'Best First'.
Re^3: cross combinations (lazy)
by tye (Sage) on Oct 28, 2005 at 15:08 UTC

    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.

        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 appreciate the explanation that gather/take allow laziness. Thank you (didn't you see my upvote?). After learing that, I moved on to wonder at something more specific...

        My point (directly above) was that I'd like to see a reasonable implementation that actually makes using gather/take actually worth using, that actually demonstrates the advantage (actually). It would even be great if that demonstration also showed how easy / natural it is to do that in Perl6 syntax.

        I think I'm (partially) with Perl Mouse in trying to understand the point of this thread in regard to Perl6. So far, it appears to be showing that Perl6 allows alternate syntax which is longer and might support laziness except that it might not by default and nobody has yet been able to demonstrate how to actually support laziness fully; and perhaps that means that Perl6 doesn't support laziness very well since it appears (so far) to make laziness difficult enough that nobody has achieved it.

        I'd be happy to see a version that takes a list of lazy lists and returns a lazy list of lists, and does it without defeating most of the purpose of laziness and (I hope) demonstrates a somewhat natural syntax. I'd also be happy to see a version that takes a lazy list of lazy lists and returns a lazy list of lazy lists, especially if it provided an interesting comparison to the former.

        - tye