On Sunday, 5 January 2020 at 13:37:58 UTC, JN wrote:
It's kind of a naive implementation, there probably is room for
improvement but should work for start.
Thanks for the input.
I just realized that I was not precise enough in my description.
Apologies for that.
My intention is to use std.algorithm, if possible.
I read the documentation and tried using many functions like
"joiner", "each", "fold", "group", "filter", etc. from
std.algorithm.iteration.
In my opinion, I need to construct a predicate like
(a, b) => if b.startsWith(<white space>) {join(a, b, " ")}
Unfortunately, I cannot figure out which combination of functions
will give me the desired result.
Of course, if I am unable to find an elegant way to do it, I am
going to iterate over the array in a way similar to what you
suggested.