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...
: I was wondering about lazy list where we don't know how many element it
: might generate. Admittedly, I picked a poor example. I would right to
: assume woops would also be accessable with @array[-1], right?
Yes, that should probably be made to work as well.
Larry