Is there a reason why std.algorithm doesn't provide a lazy range implementation of replace()?

I'm aware this isn't difficult to express using `map` like, for instance,

auto replace(S, F, T)(S, F from, T to)
{
    return s.map!(a => a == from ? to : a);
}

but I prefer syntactic sugars.

While at it we could make use of variadics to enable syntax such as

    assert(equal("do_it".replace('_', ' ',
                                 'd', 'g',
                                 'i', 't',
                                 't', 'o',
           "go to");

along with optional predicate (as usual).

What do you say?

Reply via email to