Perl 6 has lazy lists, but it also has unbounded Range objects. Which one should you choose for counting up by whole numbers?
And there's unbounded Range with two dots:
0 .. *
There's the Seq (sequence) with three dots:
0 ... *
A Range
generates lists of consecutives thingys using their natural order. It inherits from Iterable, but also Positional so you can index a range. You can check if something is within a Range
, but that's not part of the task.
A Seq
can generate just about anything you like as long as it knows how to get to the next element. It inherits from Iterable, but also PositionalBindFailover which fakes the Positional
stuff through a cache and list conversion. I don't think that a big deal if you're only moving from one element to the next.
I'm going back and forth on this. At the moment I'm thinking it's Range.
perl6-language
mailing list or the#perl6
IRC channel on freenode might be a better place for such a question... – PaulettepauleyRange
as..
is shorter than...
:p); mind, I'm happy to answer such questions, but I'm not sure it really fits here... – Paulettepauley