D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 5035 - Schrödinger's Stride
Summary: Schrödinger's Stride
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: Other All
: P2 normal
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-10-10 14:27 UTC by Tomasz Sowiński
Modified: 2010-10-12 17:18 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Tomasz Sowiński 2010-10-10 14:27:23 UTC
Currently the contents of Stride depend on from which end we look at it:

auto m = [1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4]; // 3 rows, 4 columns
auto col = stride(m, 4);
assert(equal(col, [1, 1, 1]));
assert(equal(retro(col), [4, 4, 4]));

the quantum behavior is to be fixed.
Comment 1 Tomasz Sowiński 2010-10-10 15:04:46 UTC
Please also see to that this passes:

auto m = [1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4]; // 3 rows, 4 columns
auto col = stride(m[1..$], 4);
assert(equal(col, [2, 2, 2]));
assert(equal(retro(col), [2, 2, 2]));  // now explodes
Comment 2 David Simcha 2010-10-12 17:18:25 UTC
http://dsource.org/projects/phobos/changeset/2098