problem with multiwayMerge and chunkBy
Matthew Gamble
gamblemj at gmail.com
Sun Nov 5 13:32:57 UTC 2017
On Sunday, 5 November 2017 at 03:21:06 UTC, Nicholas Wilson wrote:
> On Saturday, 4 November 2017 at 18:57:17 UTC, Matthew Gamble
> wrote:
>> [...]
>
> It should, this looks like a bug somewhere, please file one at
> issues.dlang.org/ .
>
> in the mean time
>
> struct Replicate(T)
> {
> Tuple!(T, uint) e;
> @property bool empty() { return e[1] == 0 ; }
> @property auto front() {return e[0]; }
> void popFront() { --e[1]; }
> }
>
> Replicate!T replicate(T)(Tuple!(T, uint) e)
> {
> return typeof(return)(e);
> }
>
> f.multiwayMerge.group!"a == b".map!(replicate).writeln;
>
> Does the same thing provided your predicate is "a == b".
Thanks Nicholas.
I posted the bug as you suggested. My predicate is not quite a ==
b, otherwise I would never have needed chunkBy in the first
place. But thanks, I'm pursuing a workaround.
Matt
More information about the Digitalmars-d-learn
mailing list