logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

"CPS::Governor::Simple" - iterate immediately as fast as possible

Author

       Paul Evans <leonerd@leonerd.org.uk>

perl v5.34.0                                       2022-06-30                         CPS::Governor::Simple(3pm)

Description

       This CPS::Governor allows the functions using it to run as fast as possible. It invokes its continuations
       immediately using a tailcall, so as not to let the stack grow arbitrarily.

       Its constructor takes no special arguments, and it provides no other methods beyond those of
       "CPS::Governor".

Name

       "CPS::Governor::Simple" - iterate immediately as fast as possible

Synopsis

        use CPS qw( gkforeach );
        use CPS::Governor::Simple;

        my $gov = CPS::Governor::Simple->new;

        gkforeach( $gov, [ 1 .. 10 ],
           sub {
              my ( $item, $knext ) = @_;

              print "$item\n";
              goto &$knext;
           },
           sub {},
        );

See Also