Interest in std.algorithm.joiner?

Philippe Sigaud philippe.sigaud at gmail.com
Thu Jul 29 05:03:55 PDT 2010


>
> Andrei Alexandrescu wrote:
> >>>>> Is there an interest in joiner(), the corresponding function for
> >>>>> join() that joins elements of a range in conjunction with a
> >>>>> separator without allocating a new array?
>

Seeing your code in svn, wouldn't also a flatten() (or, concat() ) function
be interesting? It transforms a range of ranges (of whatever depth) into a
linear range.

Also, interpose(range, element) that returns range[0], element, range[1],
element, etc.
and interleave(range1, range2) that produces range1[0], range2[0],
range1[1], range2[1], range1[2], ...

Isn't joiner just chain(interpose(["Mary", "has", "a", "little", "lamb"],
"...")?

std.range.transversal is a bit... short on this one: it just iterates
through a 'vertical' slice.



Philippe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20100729/aef7d90b/attachment.html>


More information about the Digitalmars-d mailing list