logo
Free, Micro AI Code Reviews That Run on Git Commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, Micro AI Code Reviews That Run on Git Commit | Product Hunt git-lrc - Free, Micro AI Code Reviews That Run on Git Commit | Product Hunt

An experimentation of implementing real lazy lists in Perl5. For real world usecases, please use Perlude

Functions

       all the Perlude documentation is relevant. just replace sub by enlist

perl v5.36.0                                       2023-02-03                                 Perlude::Lazy(3pm)

Perlude::Lazy

       An experimentation of implementing real lazy lists in Perl5.  For real world usecases, please use Perlude
       instead.

Synopsis

       Haskell prelude miss you when you write perl stuff? Perlude is a port of the most common keywords. Some
       other keywords where added when there is no haskell equivalent.

       Example: in haskell you can write

           nat        = [0..]
           is_even x  = ( x `mod` 2 ) == 0
           evens      = filter is_even
           main       =  mapM_ print
               $ take 10
               $ evens nat

       in perlude, the same code will be:

           use Perlude;
           my $nat = enlist { state $x = 0; $x++ };
           sub is_even { ($_ % 2) == 0 }
           sub evens   { filter {is_even} shift }
           traverse {say} take 10, evens $nat

See Also