Reputation: 89
I trying to compare a symbol to another alphabetically, but I can't do this. In particular, I've done this.
CL-USER 1 > (string-lessp 'k 'a)
NIL
CL-USER 2 > (string-lessp 'a 'k)
0
Thank you guys
Upvotes: 1
Views: 397
Reputation: 85853
In Common Lisp, NIL is false, and anything else is true. So in your transcript, 0 is a true value, indicating that A is before K. Rather than simply returning T and NIL, STRING-LESSP returns a mismatch index:
The inequality functions return a mismatch-index that is true if the strings are not equal, or false otherwise. When the mismatch-index is true, it is an integer representing the first character position at which the two substrings differ, as an offset from the beginning of string1.
0 is the index of the first character where the designated strings don't agree.
Upvotes: 10