[Issue 7128] New: Cartesian product of ranges

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Dec 18 09:20:34 PST 2011


http://d.puremagic.com/issues/show_bug.cgi?id=7128

           Summary: Cartesian product of ranges
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at eml.cc 2011-12-18 09:20:32 PST ---
It's useful to have a cartesian product of ranges, like a std.range.product:

http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D.learn&article_id=31050

http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D.learn&article_id=31054


See also the handy design of Python itertools.product:

http://docs.python.org/library/itertools.html#itertools.product

itertools.product(*iterables[, repeat]) 
Cartesian product of input iterables.

product('ABCD', 'xy') --> Ax Ay Bx By Cx Cy Dx Dy
product(range(2), repeat=3) --> 000 001 010 011 100 101 110 111

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list