Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Infinitely Lazy

by halley (Prior)
on Feb 07, 2005 at 19:31 UTC ( #428789=note: print w/ replies, xml ) Need Help??


in reply to Infinitely Lazy

I think I might divine what you mean by 'lazy lists' in this example, but maybe you'd give the "fifty words or less" overview of what they are, and maybe a little more to explain why you'd want to implement them at all?

I don't follow Perl 6 development too closely, but I feel like after the Apocalypse 5, things have been going damned goofy in the design of Perl 6. It seems to me that while Perl 5 is trying to be pragmatic and primordial, Perl 6 is bloating up on every "interesting" computer science concept that strikes some developer's fancy.

Perl 6 is shaping up to be the Prego of the computing world: you want it, it's in there. Will this help admins script their glue and read other people's scripts? Or will it impede adoption by being too esoteric and diverse?

--
[ e d @ h a l l e y . c c ]


Comment on Re: Infinitely Lazy
Re^2: Infinitely Lazy
by sleepingsquirrel (Hermit) on Feb 07, 2005 at 19:51 UTC
    Maybe Lazy Evaluation would be a good place to jump in?


    -- All code is 100% tested and functional unless otherwise noted.
Re^2: Infinitely Lazy
by sleepingsquirrel (Hermit) on Feb 07, 2005 at 23:58 UTC
    Although I haven't seen it myself, maybe chapters 3 & 6 of Higher-Order Perl will provide additional motivation.


    -- All code is 100% tested and functional unless otherwise noted.
Re^2: Infinitely Lazy
by bunnyman (Hermit) on Feb 08, 2005 at 16:40 UTC

    Lazy evaluation isn't esoteric and unfamiliar. If you have ever written $foo = $ENV{"FOO"} || "foo"; then you have used it.

    Ever seen this code before?

    if(grep /needle/, @haystack) { print "found it! }

    If @haystack is large and begins with "needle", then this code is searching the entire array even though it has enough information to stop after the first element. If grep were using lazy evaluation, then this code could go faster.

    Update:

    @matches = ( grep /$pattern/, @ReallyBigList )[ 0 .. $n ];

    This code gets the first $n matches in the list, but Perl is not smart enough to know it is allowed to stop searching after it has enough matches. It will search down the entire list no matter what. Lazy evaluation would be nice here too.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://428789]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (13)
As of 2014-09-17 11:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (72 votes), past polls