Re: compatible types for chains of different lengths

2015-11-17 Thread Brad Anderson via Digitalmars-d-learn
On Tuesday, 17 November 2015 at 22:47:17 UTC, Jon D wrote: I'd like to chain several ranges and operate on them. However, if the chains are different lengths, the data type is different. This makes it hard to use in a general way. There is likely an alternate way to do this that I'm missing.

compatible types for chains of different lengths

2015-11-17 Thread Jon D via Digitalmars-d-learn
I'd like to chain several ranges and operate on them. However, if the chains are different lengths, the data type is different. This makes it hard to use in a general way. There is likely an alternate way to do this that I'm missing. A short example: $ cat chain.d import std.stdio; import

Re: compatible types for chains of different lengths

2015-11-17 Thread Jon D via Digitalmars-d-learn
On Tuesday, 17 November 2015 at 23:22:58 UTC, Brad Anderson wrote: One solution: [snip] Thanks for the quick response. Extending your example, here's another style that works and may be nicer in some cases. import std.stdio; import std.range; import std.algorithm; void main(string[]