Perlude::Lazy(3pm)

πŸ’– Perlude::Lazy πŸ’–

okay bestie, so Perlude::Lazy is an experimentation of implementing real lazy lists in Perl5. that's it, that's the whole vibe. πŸ§ͺ✨

real talk tho: for actual real world usecases, please use Perlude instead. this one is the science experiment, not the product. πŸ™ˆ

🌈 SYNOPSIS 🌈

does Haskell prelude miss you when you write perl stuff?? 😭 because Perlude is a port of the most common keywords, and some other keywords where added when there is no haskell equivalent. slay.

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

like… same energy, different font. πŸ’…


✨ FUNCTIONS ✨

all the Perlude documentation is relevant. 🫢

just replace sub by enlist and you're so good, no cap. πŸ‘‘


and that's the whole page, bestie, you ate it πŸŽ€ this was Perlude::Lazy(3pm) from the User Contributed Perl Documentation era, running on perl v5.36.0, dated 2023-02-03 β€” iconic honestly, periodt. πŸ’–πŸ¦‹πŸŒΈ

πŸ“¦ where this page comes from