Combining infinite ranges
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Tue Jun 1 14:26:25 PDT 2010
On 06/01/2010 04:20 PM, Steven Schveighoffer wrote:
> On Tue, 01 Jun 2010 17:12:29 -0400, Andrei Alexandrescu
> <SeeWebsiteForEmail at erdani.org> wrote:
>
>> On 06/01/2010 04:06 PM, Steven Schveighoffer wrote:
>>> On Tue, 01 Jun 2010 13:54:01 -0400, Andrei Alexandrescu
>>> <SeeWebsiteForEmail at erdani.org> wrote:
>>>
>>>> The output of the program is:
>>>>
>>>> 0 Tuple!(uint,uint)(0, 0)
>>>> 1 Tuple!(uint,uint)(0, 1)
>>>> 2 Tuple!(uint,uint)(1, 1)
>>>> 3 Tuple!(uint,uint)(1, 0)
>>>> 4 Tuple!(uint,uint)(0, 2)
>>>> 5 Tuple!(uint,uint)(1, 2)
>>>> 6 Tuple!(uint,uint)(2, 2)
>>>> 7 Tuple!(uint,uint)(2, 0)
>>>> 8 Tuple!(uint,uint)(2, 1)
>>>> 9 Tuple!(uint,uint)(0, 3)
>>>> 10 Tuple!(uint,uint)(1, 3)
>>>> 11 Tuple!(uint,uint)(2, 3)
>>>> 12 Tuple!(uint,uint)(0, 4)
>>>> 13 Tuple!(uint,uint)(1, 4)
>>>> 14 Tuple!(uint,uint)(2, 4)
>>>
>>> It looks like you're missing some iterations there.
>>>
>>> -Steve
>>
>> There should be 5 * 3 = 15 iterations.
>
> Oh, I didn't realize the input was not two infinite ranges. I was
> looking at this as the first 15 lines from the output of 2 infinite
> ranges. I expected to see (3, 0), (3, 1), (3, 2), and (3, 3).
>
> My bad, I guess I should have read the code.
>
> -Steve
Funniest thing is the infinite ranges code was _much_ easier to get
right. I got it rolling in a few minutes. It was the limit conditions
for the finite ranges that killed me.
Andrei
More information about the Digitalmars-d
mailing list