Solomon Foster wrote:
> Ranges haven't been intended to be the "right way" to construct basic
> loops for some time now. That's what the "..." series operator is
> for.
>
> for 1e10 ... 1 -> $i {
> # whatever
> }
>
> is lazy by the spec, and in fact is lazy and fully functional in
> Rakudo. (Errr... okay, actually it just seg faulted after hitting
> 9999968746 in the countdown. But that's a Rakudo bug unrelated to
> this, I'm pretty sure.)
You took the words out of my mouth.
> All the magic that one wants for handling loop indices -- going
> backwards, skipping numbers, geometric series, and more -- is present
> in the series operator. Range is not supposed to do any of that stuff
> other than the most basic forward sequence.
Here, though, I'm not so sure: I'd like to see how many of Aaron's
issues remain unresolved once he reframes them in terms of the series
operator.
--
Jonathan "Dataweaver" Lang