D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 9082 - Add "interleave" function
Summary: Add "interleave" function
Status: RESOLVED WONTFIX
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: All All
: P2 enhancement
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-11-27 04:05 UTC by Andrej Mitrovic
Modified: 2016-04-28 14:21 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Andrej Mitrovic 2012-11-27 04:05:05 UTC
int[] arr = [1, 2, 3].join(0);  // fail

Expected:
[1, 0, 2, 0, 3]

This should work with any separator type if it's the element type of the range.
Comment 1 Andrej Mitrovic 2012-11-27 15:36:29 UTC
Changed summary. 'join' doesn't work in the way I thought it was, what I'm looking for is something different, an "interleave" type of function.
Comment 2 Jack Stouffer 2016-04-05 00:28:17 UTC
std.range.roundRobin(
    [1, 2, 3],
    0.repeat(2)
);
Comment 3 Jack Stouffer 2016-04-28 14:21:25 UTC
See https://github.com/dlang/phobos/pull/4251