in reply to Re^2: Efficient but elegant Cross-Product iterator ?
in thread Efficient but elegant Cross-Product iterator ?

Well yeah. You necessarily need to store the results of the subs somewhere, and in what else would store the results of the subs but in arrays?

  • Comment on Re^3: Efficient but elegant Cross-Product iterator ?

Replies are listed 'Best First'.
Re^4: Efficient but elegant Cross-Product iterator ?
by LanX (Saint) on Jun 20, 2020 at 22:00 UTC
    NestedLoops allows to pass code-refs, i.e. they will be dynamically (re-)evaluated each time one loop-level is (re-)entered.

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery

      Ah, so it will create the arrays for you, cool. (Added the alternate solution to my earlier post.)

        It's also semantically different!

        The subs don't need to return a constant list, so each loop might restart with a new dynamic list.

        Cheers Rolf
        (addicted to the Perl Programming Language :)
        Wikisyntax for the Monastery