On 10/11/10 21:05 CDT, Philippe Sigaud wrote:
On Tue, Oct 12, 2010 at 02:33, Andrei Alexandrescu
<seewebsiteforem...@erdani.org>  wrote:
One thing is still bothering me: the array output type. Why would the
"default" output range be an array? What can be done to make join() at the
same time a general function and also one that works for strings the way the
old join did? For example, if I want to join things into an already-existing
buffer, or if I want to write them straight to a file, there's no way to do
so without having an array allocation in the loop. I have a couple of ideas
but I wouldn't want to bias yours.

Let to my own, I'd make that a lazy Join struct range: an input range
that delivers R1 elements one by one, interspersed with R2 elements.
Hmm, now that I think a bit more, I was taking them both (or at least
R1) to be ranges of ranges:  join(["the","quick","red","fox"], " ").
Man, it's 4 pm now, I'll stop.

You must mean 4am :o). The abstraction you talk about is already implemented in std.algorithm.joiner(). Here I'm discussing eager join.

Andrei

Reply via email to