Either way is fine with me. But it’s probably best to copy Python’s semantics:
http://docs.python.org/py3k/library/functions.html#range
On Jan 3, 2012, at 18:50 , Sean Eagan wrote:
> I think step should be > 0, and step towards end:
>
> Array.range({start: 5, end: 0, step: 2}) -> 5, 3, 1
>
> On Tue, Jan 3, 2012 at 11:42 AM, Axel Rauschmayer <[email protected]> wrote:
>> I think it's fairly common for range implementations to provide an optional
>> `step` parameter
>>
>>
>> Good point. Maybe all of these parameters should be options:
>>
>> Array.range() -> 0, 1, 2, 3, ...
>> Array.range({ start: 3 }) -> 3, 4, 5, 6, ...
>> Array.range({ end: 5 }) -> 0, 1, 2, 3, 4
>> Array.range({ step: 3 }) -> 0, 3, 6, 9, ...
>> Array.range({ start: -2, step: -1 }) -> -2, -3, -4, -5, ...
>> etc.
>>
>> The defaults of start and end and the comparison operator depend on the sign
>> of step.
>>
>> --
>> Dr. Axel Rauschmayer
>> [email protected]
>>
>> home: rauschma.de
>> twitter: twitter.com/rauschma
>> blog: 2ality.com
>>
>>
>>
>>
>> _______________________________________________
>> es-discuss mailing list
>> [email protected]
>> https://mail.mozilla.org/listinfo/es-discuss
>>
>
>
>
> --
> Sean Eagan
>
--
Dr. Axel Rauschmayer
[email protected]
home: rauschma.de
twitter: twitter.com/rauschma
blog: 2ality.com
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss