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)
confuses users


*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:*
 nobody

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
comparing characters.»):

(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
non-alphabetic ones.

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)
http://juanjose.garciaripoll.googlepages.com
------------------------------------------------------------------------------
Got visibility?
Most devs has no idea what their production app looks like.
Find out how fast your code is with AppDynamics Lite.
http://ad.doubleclick.net/clk;262219671;13503038;y?
http://info.appdynamics.com/FreeJavaPerformanceDownload.html
_______________________________________________
Ecls-list mailing list
Ecls-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ecls-list

Reply via email to