[Challenge] implementing the ambiguous operator in D

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Mon Sep 6 07:18:50 PDT 2010


On 09/06/2010 06:51 AM, Peter Alexander wrote:
> == Quote from Andrei Alexandrescu
>> Yah, per your follow-up post, it's a different problem. It's
> also a much
>> more difficult one. I convinced myself crossProduct is
> impossible to
>> implement if one input range and one infinite forward range are
>> simultaneously present. It works with any number of infinite
> forward
>> ranges, and also with other combinations. I couldn't formalize
> the exact
>> requirements yet.
>
> I must be missing something, because I don't understand how you
> could possibly take the cross product of any number of infinite
> ranges (other than to just return the range of (a[0], b[i]) for
> all (infinitely many) i in b).
>
> Note that I'm assuming you mean cartesian product, rather than
> cross product; I've never heard cross product used in the context
> of sets.

Yah, thanks for the correction. But probably ranges could be easier seen 
as vectors than as sets.

We've discussed this before. Crosscartesian product of multiple infinite 
ranges can be easily done by applying Cantor's trick for proving that 
rational numbers are just as numerous than natural numbers. Google for 
"Cantor" with "site:digitalmars.com".


Andrei


More information about the Digitalmars-d mailing list