On Tue, Jul 20, 2010 at 10:00 PM, Jon Lang <datawea...@gmail.com> wrote:
> 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.

Sorry, didn't mean to imply the series operator was perfect.  (Though
it is surprisingly awesome in  general, IMO.)  Just that the right
questions would be about the series operator rather than Ranges.

The questions definitely look different that way: for example,
ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz is easily and
clearly expressed as

    'A' ... 'Z', 'a' ... 'z'     # don't think this works in Rakudo yet  :(

That suggests to me that the current behavior of 'A' ... 'z' is pretty
reasonable.

-- 
Solomon Foster: colo...@gmail.com
HarmonyWare, Inc: http://www.harmonyware.com

Reply via email to