Thread overview | |||||||
---|---|---|---|---|---|---|---|
|
September 22, 2018 transposed with enforceNotJagged not throwing? | ||||
---|---|---|---|---|
| ||||
I expect this small program to throw an Exception: > import std.stdio; > import std.range; > > void main() > { > auto a = [[1,2], > [4,5,3]]; > > a.transposed!(TransverseOptions.enforceNotJagged).writeln; > } But it just outputs: > [[1, 4], [2, 5], [3]] Is it a bug or is it me who's doing something wrong? |
September 22, 2018 Re: transposed with enforceNotJagged not throwing? | ||||
---|---|---|---|---|
| ||||
Posted in reply to berni | On Saturday, 22 September 2018 at 06:16:41 UTC, berni wrote:
> Is it a bug or is it me who's doing something wrong?
Looking at the implementation, it looks like enforceNotJagged was just never implemented for transposed (only transversed).
|
September 22, 2018 Re: transposed with enforceNotJagged not throwing? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Vladimir Panteleev | On 9/22/18 4:10 AM, Vladimir Panteleev wrote: > On Saturday, 22 September 2018 at 06:16:41 UTC, berni wrote: >> Is it a bug or is it me who's doing something wrong? > > Looking at the implementation, it looks like enforceNotJagged was just never implemented for transposed (only transversed). > It was suggested when transposed was fixed to include opIndex, but never implemented. https://github.com/dlang/phobos/pull/5805#discussion_r148251621 -Steve |
September 22, 2018 Re: transposed with enforceNotJagged not throwing? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Steven Schveighoffer | On Saturday, 22 September 2018 at 12:52:45 UTC, Steven Schveighoffer wrote:
> It was suggested when transposed was fixed to include opIndex, but never implemented.
Maybe I'm too naive, but isn't it easy to implement it just the same way, it is done with transverse? That is: putting the "static if"-part from the constructor there in the constructor of Transposed?
|
September 24, 2018 Re: transposed with enforceNotJagged not throwing? | ||||
---|---|---|---|---|
| ||||
Posted in reply to berni | On 9/22/18 4:37 PM, berni wrote: > On Saturday, 22 September 2018 at 12:52:45 UTC, Steven Schveighoffer wrote: >> It was suggested when transposed was fixed to include opIndex, but never implemented. > > Maybe I'm too naive, but isn't it easy to implement it just the same way, it is done with transverse? That is: putting the "static if"-part from the constructor there in the constructor of Transposed? > You're not too naive, it would be easy (I think I said as much here: https://github.com/dlang/phobos/pull/5805#issuecomment-341234846). It just wasn't done in that pull (which was focused on a different problem). Please feel free to submit a fix! -Steve |
Copyright © 1999-2021 by the D Language Foundation