On Friday, 27 March 2015 at 16:55:34 UTC, Tobias Pankrath wrote:
Regarding the scscscshghshshshhswarzThing, here we discuss the readability and accessibility of the documentation, not the power of the library. Every other language will use a variation of "sortBy" instead of the scscshwcwscThing. I'm happy that D has in the default lib functions like levenshteinDistance, but this will not attract the average or "just starting to learn" developer. On the contrary, sorting correctly some names is a more common task than calculating the Levenshtein distance, but there is no function for it in phobos.

You may have a point that schwartzSort has a bad name (I disagree), but putting another algorithm does not make the documentation worse per se. Dunno, what problem you have with the levenshteinDistance.

schwartzSort it's a nice name only if you are German. You got me wrong, I have nothing against the function itself, nor against the presence in the stdlib, but I play the role of the devil's advocate and I try to walk in the D's new user shoes who's expecting probably something more readable than 4 stuffed consonants. Personally, I know what a Schwartz transform is and I speak some German :)


On the contrary, sorting correctly some names is a more common task than calculating the Levenshtein distance, but there is no function for it in phobos.

What do you mean by correct? http://unicode.org/reports/tr10/?

From the link you posted:

"Collation is not aligned with character sets or repertoires of characters. Swedish and German share most of the same characters, for example, but have *very different* sorting orders."


"We even have something obscure like levenshteinDistance but no implementation for the unicode collation algorithm, which all newcomers are looking for!" is a) a questionable comparison between a relative simple algorithm and a monster and b) wrong, because 99% of programmers don't even know about the algorithm itself, thus they aren't looking for it.

I explained this in another topic regarding portability obsession, it's a monster probably on Linux, on Windows/Mac it's exactly one line of code, already done it:

https://github.com/rumbu13/sharp/blob/master/src/internals/locale.d#L518


BTW. python's startwith does the Köln example wrong. Kö and Ko\u0308 dont match.

Today was my first contact with Python, I cannot comment on this, may be Python is not aware of normalization forms and is not combining o with the diaeresis (u0308).

Reply via email to