Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Shift and Unshift on Inf lists

16 views
Skip to first unread message

Stevan Little

unread,
Apr 17, 2005, 11:48:58 PM4/17/05
to perl6-c...@perl.org
Okay, more edge cases here.

Both these examples:

pugs -e 'my @a = (1 .. Inf); shift(@a);'
pugs -e 'my @a = (1 .. Inf); unshift(@a, 10);'

take forever (or rather, however long Inf is, but that is a discussion
for another list).

I think this might be the wrong behavior. I would expect that for pop()
or push() which need to find the end of the list, and therefore take a
*very* long time. But why do shift() and unshift() need to find the end
of the list?

I freely admit that I may be completely naive on this subject, so
please correct me if I am wrong.

Thanks,

Stevan

0 new messages