digitalmars.D.learn - Iterate over two arguments at once
- bachmeier (6/6) Sep 19 2016 Suppose I want to iterate over two arrays at once:
- Lodovico Giaretta (5/11) Sep 19 2016 You can use std.range.zip:
- Steven Schveighoffer (3/9) Sep 19 2016 http://dlang.org/phobos/std_range.html#.zip
- Jon Degenhardt (2/8) Sep 19 2016 range.lockstep: https://dlang.org/phobos/std_range.html#lockstep
- bachmeier (2/8) Sep 19 2016 Thanks for the replies. This is what I needed.
Suppose I want to iterate over two arrays at once:
foreach(v1, v2; [1.5, 2.5, 3.5], [4.5, 5.5, 6.5]) {
...
}
I have seen a way to do this but cannot remember what it is and
cannot find it.
Sep 19 2016
On Monday, 19 September 2016 at 18:10:22 UTC, bachmeier wrote:
Suppose I want to iterate over two arrays at once:
foreach(v1, v2; [1.5, 2.5, 3.5], [4.5, 5.5, 6.5]) {
...
}
I have seen a way to do this but cannot remember what it is and
cannot find it.
You can use std.range.zip:
https://dlang.org/phobos/std_range.html#.zip
Or std.range.lockstep:
https://dlang.org/phobos/std_range.html#.lockstep
Sep 19 2016
On 9/19/16 2:10 PM, bachmeier wrote:
Suppose I want to iterate over two arrays at once:
foreach(v1, v2; [1.5, 2.5, 3.5], [4.5, 5.5, 6.5]) {
...
}
I have seen a way to do this but cannot remember what it is and cannot
find it.
-Steve
Sep 19 2016
On Monday, 19 September 2016 at 18:10:22 UTC, bachmeier wrote:
Suppose I want to iterate over two arrays at once:
foreach(v1, v2; [1.5, 2.5, 3.5], [4.5, 5.5, 6.5]) {
...
}
I have seen a way to do this but cannot remember what it is and
cannot find it.
range.lockstep: https://dlang.org/phobos/std_range.html#lockstep
Sep 19 2016
On Monday, 19 September 2016 at 18:10:22 UTC, bachmeier wrote:
Suppose I want to iterate over two arrays at once:
foreach(v1, v2; [1.5, 2.5, 3.5], [4.5, 5.5, 6.5]) {
...
}
I have seen a way to do this but cannot remember what it is and
cannot find it.
Thanks for the replies. This is what I needed.
Sep 19 2016









Lodovico Giaretta <lodovico giaretart.net> 