www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Understanding slide

reply Jordan Wilson <wilsonjord gmail.com> writes:
auto a = iota(5).slide!(Yes.withPartial)(3);
auto b = iota(5).slide!(No.withPartial)(3);
assert (a.equal(b));

The assert passes, but I would expect it to fail? They both are:
[[0,1,2],[1,2,3],[2,3,4]]

Thanks,

Jordan
Mar 21 2018
parent reply Seb <seb wilzba.ch> writes:
On Thursday, 22 March 2018 at 03:39:38 UTC, Jordan Wilson wrote:
 auto a = iota(5).slide!(Yes.withPartial)(3);
 auto b = iota(5).slide!(No.withPartial)(3);
 assert (a.equal(b));

 The assert passes, but I would expect it to fail? They both are:
 [[0,1,2],[1,2,3],[2,3,4]]

 Thanks,

 Jordan
See: https://forum.dlang.org/post/asocdlqaihkskiilrajd forum.dlang.org
Mar 21 2018
next sibling parent Seb <seb wilzba.ch> writes:
On Thursday, 22 March 2018 at 03:58:35 UTC, Seb wrote:
 On Thursday, 22 March 2018 at 03:39:38 UTC, Jordan Wilson wrote:
 auto a = iota(5).slide!(Yes.withPartial)(3);
 auto b = iota(5).slide!(No.withPartial)(3);
 assert (a.equal(b));

 The assert passes, but I would expect it to fail? They both 
 are:
 [[0,1,2],[1,2,3],[2,3,4]]

 Thanks,

 Jordan
See: https://forum.dlang.org/post/asocdlqaihkskiilrajd forum.dlang.org
PR to improve the docs: https://github.com/dlang/phobos/pull/6322
Mar 21 2018
prev sibling parent Jordan Wilson <wilsonjord gmail.com> writes:
On Thursday, 22 March 2018 at 03:58:35 UTC, Seb wrote:
 On Thursday, 22 March 2018 at 03:39:38 UTC, Jordan Wilson wrote:
 auto a = iota(5).slide!(Yes.withPartial)(3);
 auto b = iota(5).slide!(No.withPartial)(3);
 assert (a.equal(b));

 The assert passes, but I would expect it to fail? They both 
 are:
 [[0,1,2],[1,2,3],[2,3,4]]

 Thanks,

 Jordan
See: https://forum.dlang.org/post/asocdlqaihkskiilrajd forum.dlang.org
Ah I see. Apologies, I normally read the forums every day, must have just missed this one. Thanks
Mar 22 2018