Thus it was written in the epistle of John Porter,
> Ken Fox wrote:
> >
> > Both of those expressions are the infinite list (-infinity..-1). I have
> > no idea how to write that properly 'cause I'm not a math guy. These
> > things aren't streams (infinite queues) -- they're infinite stacks. I'm
> > not sure they have a name in computer science.
>
> O.k., here's the basic question. (If someone has already answered this,
> I didn't find it satisfactorily comprehensible. Assume I'm an idiot.)
>
> What would be the output of the following program:
>
> $\ = "\n";
> $i = 0;
> for ( .. -1 ) {
> $i++;
> last if $i > 2;
> print
> }
>
> If the answer is (as I suspect), "This never prints anything; it goes
> into an infinite loop just trying to generate the first number", then
> the proposal is absurd and should be scrapped.
By my understanding (which is definitely not very thorough), the output would
be a run-time error. And I think that
$\ = "\n";
$i = 0;
for ( .. -1 ) {
next unless $_ > -10;
$i++;
last if $i > 2;
print
}
is supposed to print
-9
-8
How it would know to do that is beyond my ken, but I believe that is what it
is expected to do.
Ted
--
Ted Ashton ([EMAIL PROTECTED]), Info Sys, Southern Adventist University
==========================================================
Leibniz never married; he had considered it at the age of fifty; but the
person he had in mind asked for time to reflect. This gave Leibniz time to
reflect, too, and so he never married.
-- Fontenelle, Bernard Le Bovier (1657-1757)
==========================================================
Deep thoughts to be found at http://www.southern.edu/~ashted