repeat
Adam Ruppe
destructionator at gmail.com
Mon Jan 17 10:53:33 PST 2011
It seems to me that you actually want two separate functions:
repeat("abc", 3) => ["abc", "abc", "abc"]
join(repeat("abc", 3)) => "abcabcabc"
A join function already exists in std.string and does this, although
it expects a second argument for word separator. I'd be ok with adding
a default arg to it, the empty string, so this works.
Indeed, we could do lazy this same way... have both return the
lazy ranges, and if your want the array, just call array() on it.
Though I could see that being annoying with strings - the array
probably is the common case, but this would be more conceptually pure.
More information about the Digitalmars-d
mailing list