Michael Zedeler wrote:
>> The obvious (default) choice for a step size would be the precision of
>> the more precise of the two values.  So 0.0001 in your example above.
>>
>
> Well... maybe. How do you specify the intended precision, then? If I want
> the values from 1 to 2 with step size 0.01, I guess that writing
>
> 1.00 .. 2.00
>
> won't be sufficient. Trying to work out the step size by looking at the
> precision of things that are double or floats doesn't really sound so
> feasible, since there are a lot of holes in the actual representation, so
> 1.0001 may become 1.0, yielding very different results.
>
> It could be really nice to come up with something dwimmy, but I can't really
> se any really good candidates, when it comes to floating point numbers and
> strings.

For floating point numbers, assume a default step size of 1, just like
integers; use the :by adverb to specify a different step size, either
by supplying a floating point number to be added in or by supplying a
block that generates the next step when fed the current one.  So:

1.00 .. 2.00 # 1.00, 2.00
1.00 .. 2.00 :by .01 # 1.00, 1.01, 1.02, ..., 1.98, 1.99, 2.00

Also, I want to second David Green's point: we're not talking "Range"
and "Interval" here; we're talking "Range" and "Series".  A Series
would be a kind of Range that has the additional ability of generating
a list.  The :by adverb would be a property of a Series, but not a
Range.  Using Num for your endpoints would result in a Series; using
Complex for your endpoints should result in an error: Complex numbers
don't have a viable definition of "before" or "after", let alone
"between".

-- 
Jonathan "Dataweaver" Lang

Reply via email to