std.algorithm issue

Brian Myers bmyers at harryanddavid.com
Thu May 22 16:10:33 PDT 2008


I'll look into submitting a bug report to Walter. Thanx bearophile.

Dee Girl, I'm actually not merging strings. The strings are file names. Merge is the merge phase for an external sort. In my next project I'll use map to do something like what you're talking about. I'll have to test the difference between map!-ing a custom function and doing join, and using reduce and a custom function.

Thanx to both of you.

Brian

bearophile Wrote:

> Brian Myers:
> >     string Merge(string f1, string f2) {
> >     .
> >     .
> >     .
> >     }
> 
> I don't exactly know what you are trying to do, but using s1~s2 to merge an array of strings is probably O(n^2) if the higher order functions you use (or the compiler) aren't smart enough.
> There is a join() function in std.string that is O(1), and there's a faster version of it in my libs (and probably in Tango too).
> 
> Bye,
> bearophile




More information about the Digitalmars-d mailing list