Thread overview
[Issue 9593] Optional type-free printing of a std.typecons.Tuple
May 13, 2014
Andrej Mitrovic
Feb 13, 2021
Walter Bright
Dec 17, 2022
Iain Buclaw
May 13, 2014
https://issues.dlang.org/show_bug.cgi?id=9593

--- Comment #1 from Andrej Mitrovic <andrej.mitrovich@gmail.com> ---
*** Issue 12743 has been marked as a duplicate of this issue. ***

--
January 08, 2015
https://issues.dlang.org/show_bug.cgi?id=9593

--- Comment #2 from bearophile_hugs@eml.cc ---
Sometimes the output is so much noisy that it's unreadable:

void main() {
    import std.stdio: writeln;
    import std.algorithm: cartesianProduct;
    import std.range: enumerate;
    auto a = [10, 20];
    cartesianProduct(a.enumerate, a.enumerate)
    .writeln;
}


Output:

[Tuple!(Tuple!(uint, "index", int, "value"), Tuple!(uint, "index", int,
"value"))(Tuple!(uint, "index", int, "value")(0, 10), Tuple!(uint, "index",
int, "value")(0, 10)), Tuple!(Tuple!(uint, "index", int, "value"), Tuple!(uint,
"index", int, "value"))(Tuple!(uint, "index", int, "value")(0, 10),
Tuple!(uint, "index", int, "value")(1, 20)), Tuple!(Tuple!(uint, "index", int,
"value"), Tuple!(uint, "index", int, "value"))(Tuple!(uint, "index", int,
"value")(1, 20), Tuple!(uint, "index", int, "value")(0, 10)),
Tuple!(Tuple!(uint, "index", int, "value"), Tuple!(uint, "index", int,
"value"))(Tuple!(uint, "index", int, "value")(1, 20), Tuple!(uint, "index",
int, "value")(1, 20))]


A similar Python program:

from itertools import product
a = [10, 20]
print list(product(enumerate(a), enumerate(a)))


Prints a readable output:

[((0, 10), (0, 10)), ((0, 10), (1, 20)), ((1, 20), (0, 10)), ((1, 20), (1,
20))]

--
February 13, 2021
https://issues.dlang.org/show_bug.cgi?id=9593

Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://issues.dlang.org/sh
                   |                            |ow_bug.cgi?id=3248

--
December 17, 2022
https://issues.dlang.org/show_bug.cgi?id=9593

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P2                          |P4

--