http://qs1969.pair.com?node_id=428789


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 ]

Replies are listed 'Best First'.
Re^2: Infinitely Lazy
by sleepingsquirrel (Chaplain) 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 (Chaplain) 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.