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

all list constructors are iterators?

8 views
Skip to first unread message

Ph. Marek

unread,
Apr 14, 2003, 2:00:03 AM4/14/03
to perl6-l...@perl.org
Hello everyone!

I already read some nice things on this list, like lazy evaluation,
possibility of @a=(1 .. Inf), and so on.

Now I've got some questions.

Does
@a = (1 .. Inf);
splice @a,5,2;
yield
@a = (1 .. 4, 7 .. Inf) ?

Is x iterating like .. ?
So that
@a = ( (1 .. Inf) x 10 );
or even
@a = ( ( 1 .. Inf) x Inf );
is possible?


Thank you for your answers!


Regards,

Phil


Luke Palmer

unread,
Apr 14, 2003, 11:50:26 AM4/14/03
to philip...@bmlv.gv.at, perl6-l...@perl.org
> Hello everyone!
>
> I already read some nice things on this list, like lazy evaluation,
> possibility of @a=(1 .. Inf), and so on.
>
> Now I've got some questions.
>
> Does
> @a = (1 .. Inf);
> splice @a,5,2;
> yield
> @a = (1 .. 4, 7 .. Inf) ?

Yep.

> Is x iterating like .. ?
> So that
> @a = ( (1 .. Inf) x 10 );
> or even
> @a = ( ( 1 .. Inf) x Inf );
> is possible?

Yeah, but don't expect to get past the first Inf when iterating.

Infinite lists have to act just like regular lists, except that
they're infinite. It's tough on the implementation, but possible.

Luke

0 new messages