digitalmars.D.bugs - [Issue 17966] New: chunkBy cannot accept an input range (from
- d-bugmail puremagic.com (37/37) Nov 05 2017 https://issues.dlang.org/show_bug.cgi?id=17966
https://issues.dlang.org/show_bug.cgi?id=17966 Issue ID: 17966 Summary: chunkBy cannot accept an input range (from multiwayMerge) Product: D Version: D2 Hardware: x86_64 OS: Windows Status: NEW Severity: normal Priority: P1 Component: phobos Assignee: nobody puremagic.com Reporter: gamblemj gmail.com I posted this issue to forum.dlang.org/learn https://forum.dlang.org/post/fzgzvwytjbdqozviopzk forum.dlang.org I was asked to post this here by Nicholas Wilson, who responded to my post on "learn". This is my first post here, apologies I did it wrong. I guess there are two issues one of which seems to be a bug. The bug: chunkBy is advertised as working on input ranges, but it seems that it doesn't. The smaller issue: Why can't multiwayMerge produce a forward range instead of input range? auto d =[2,4,6,8]; auto e =[1,2,3,5,7]; auto f =[d,e]; writeln(f.multiwayMerge.chunkBy!"a == b");//error happens writeln(f.multiwayMerge.array.chunkBy!"a == b");//no error, but there must be a better way! I know the test code seems silly. Why not just use multiwayUnion and no need for chunkBy? However, this is a dumbed down version to show the error. There are use cases where "a == b" is a bit more complicated and the underlying elements are not completely equivalent and so you want them all grouped together, in which case multiwayUnion is not going to do the right thing. OK, hope I did this right. Matt --
Nov 05 2017