You can write a sub to return the next step: sub bondigi { state $n=1; return (<Bon Digi Bon Digi>, <Bon> xx $n, <Digi> xx $n++); }
but I think an idiomatic Perl 6 solution would have a proper lazy Iterator. How do we write one of those?
You can write a sub to return the next step: sub bondigi { state $n=1; return (<Bon Digi Bon Digi>, <Bon> xx $n, <Digi> xx $n++); }
but I think an idiomatic Perl 6 solution would have a proper lazy Iterator. How do we write one of those?