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

Almost, instead of code refs, you are expanding the subs to arrays before passing them.

For this simplified example the result is the same though.

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

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

Replies are listed 'Best First'.
Re^3: Efficient but elegant Cross-Product iterator ?
by ikegami (Patriarch) on Jun 20, 2020 at 21:59 UTC

    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?

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