----- Original Message ----- From: Larry Wall <[EMAIL PROTECTED]> Date: Wednesday, July 7, 2004 11:25 pm Subject: Re: push with lazy lists
> On Fri, Jul 02, 2004 at 09:32:07PM -0500, Dan Hursh wrote: > : how 'bout > : > : @x = gather{ > : loop{ > : take time > : } > : } # can this be @x = gather { take time loop } > : push @x, "later"; > : say pop @x; # "later" > > Can probably be made to work right. > > : say pop @x; # heat death? > > Yes. > > : say @x[rand]; # how about now? > > Well, that's always going to ask for @x[0], which isn't a problem. > However, if you say rand(@x), it has to calculate the number of > elements in @x, which could take a little while... Why would the second pop be a heat death, and why would rand always return 0? - Joe