Re: help on cartesianProduct()

2016-12-12 Thread Orut via Digitalmars-d-learn
On Sunday, 11 December 2016 at 23:07:16 UTC, Era Scarecrow wrote: On Sunday, 11 December 2016 at 18:05:19 UTC, Era Scarecrow wrote: On Sunday, 11 December 2016 at 16:34:38 UTC, Orut wrote: I need to be able to vary the number of ranges to feed into cartesianProduct() at run time. Hmmm...

help on cartesianProduct()

2016-12-11 Thread Orut via Digitalmars-d-learn
Am trying to port some Python code to D and I got stumped on the use of cartesianProduct() from std.algorithm.setops. In Python, the same functionality is implemented by product() in the itertools module. I need to be able to vary the number of ranges to feed into cartesianProduct() at run

Re: faster "stringification"

2016-12-11 Thread Orut via Digitalmars-d-learn
On Sunday, 11 December 2016 at 02:46:58 UTC, Nicholas Wilson wrote: join performs allocations which is probably the reason for its slowness. There is joiner (in std.algorithm.iterations) that lazily performs the join, (though in the case of this "benchmark" will be cheating because you don't

faster "stringification"

2016-12-10 Thread Orut via Digitalmars-d-learn
D nub here. I have a Python script that I'd like to implement in D. For certain parts, the D equivalent was slower than Python's. For example, Python code: #dummy code s = ["abc", "fjkd", "L", "qwa", "r", "uw", "tiro", "bc", "sg", "k", "jds", "yd"]; for i in range(1000): # a lot of