Subject: Re: Beginner question: performance problems with a simple program From: Erik Naggum <erik@naggum.net> Date: Thu, 03 Jan 2002 16:17:12 GMT Newsgroups: comp.lang.lisp Message-ID: <3219063429863038@naggum.net> * Aleksandr Skobelev <holycheck@mail.ru> | So, any non-English string won't be compared correctly? _Please_ try to understand there is no _one_ correct way to compare strings. Monoculturalism is simply wrong. That is why one chooses technical specifications that have arbitrary, but very predictable results. Making string< attempt to do culturally sensitive string comparisons would _always_ be wrong, because it is not specified to do that, was never intended to do that, and should never be intended or specified to do that if language designers do their job. The only reasonable way to do string< is to do it with repeated char<, which can only be done as < on char-code of the two characters (in practice, with machine less-than operations on the internal representation of the character object). In Common Lisp, that is precisely what it does. The only _correct_ way to do culturally sensitive sorting is to maintain a collation information string in addition to the "data" string. If you are unwilling to do this work, whoever employed you should get a refund, and if you did not know, whoever you paid for your education should be prepared to give you a refund, unless he demonstrated that you failed to do what you were told. So here is a hint: If you want to compare two strings with culturally sensitive contents, you need to know: which language both are in, how to convert strings of that language into collation information strings, and then compare the result with string<. Do _not_ try to roll this into one function or make assumptions about the language in use. And _please_ note that string< does not work for English, either. English is _not_ spelled correctly only using ASCII. Why are you behaving as if you are _envious_ of the fact that Common Lisp happened to be defined in the United States? Nobody forces you to use the functions that do not fill your needs. Please quit making it anybody else's problems -- just go implement what you think is right. (Whether you share it with others afterwards is not for me to suggest, but if you are concerned with the proper sorting of your natural language, it would seem reasonable to expect you to publish it, for pay or not.) /// --