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
- debian bookworm: libperlude-perl 0.61-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libperlude-perl 0.61-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libperlude-perl 0.61-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libperlude-perl 0.61-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libperlude-perl 0.61-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms