www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 24541] New: cartesianProduct should have length for finite

https://issues.dlang.org/show_bug.cgi?id=24541

          Issue ID: 24541
           Summary: cartesianProduct should have length for finite ranges
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P4
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: dlang-bugzilla thecybershadow.net

Does not compile:

    import std.algorithm.setops;
    assert(cartesianProduct([1, 2], [3, 4]).length == 4);

Currently the code does:

        return joiner(map!((ElementType!R1 a) => zip(repeat(a), range2.save))
                          (range1));

--
May 07