[Ecls-list] Fwd: [ecls:bugs] #206 string-lessp does not behave as string< ignoring case
Juan Jose Garcia-Ripoll
jjgarcia at users.sourceforge.net
Fri Sep 21 19:46:32 UTC 2012
Could you people have a look at the bug report and my answer? I believe I
am right, though SBCL is reporting a different order and this (once more)
*bugs:206 string-lessp does not behave as string< ignoring case*
*Status:* open *Created:* Thu Sep 20, 2012 09:43 PM UTC by Rafael Jesús
Alcántara Pérez *Last Updated:* Thu Sep 20, 2012 09:43 PM UTC *Owner:*
Ignoring case, this two function calls should behave the same
(«string-lessp and string-greaterp are exactly like string< and string>,
respectively, except that distinctions between uppercase and lowercase
letters are ignored. It is as if char-lessp were used instead of char< for
(string< "a_" "aa") => 1
(string-lessp "a_" "aa") => nil
But this is not the case. Am I missing something?
STRING-LESSP is indeed implemented using CHAR-LESSP but your expectations
about how this function should behave are wrong. Note that the Common Lisp
standard states that CHAR-LESSP ignores case but it must do so not only
when both characters are alphabetic, but also when comparing alphabetic and
An ordering must be transitive (A < B) and (B < X) must imply (A < X). Take
for instance #\_, #\a and #\A. We have (< #\A #\_ #\a) Now you only want
(CHAR-LESSP #\A #\a) to change value but this destroys transitivity.
The only way to achieve this with CHAR-LESSP is to convert the character
first to one case and then perform the comparison, which is what has been
done for a long time with Common Lisps.
Instituto de Física Fundamental, CSIC
c/ Serrano, 113b, Madrid 28006 (Spain)
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the ecl-devel