What is the purpose of this table?

  • Thread starter Thread starter MissP.25_5
  • Start date Start date
  • Tags Tags
    Programming
Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
4 replies · 2K views
MissP.25_5
Messages
329
Reaction score
0
I am learning scheme programming.
What is the result of this?

(define (small a b)
(string<? (first a) (first b))

And the list is (list "apple" "100 yen").

What is the first a and what is the first b? Is it "a" and "1"? If so, between these two, which is lesser?
 
Physics news on Phys.org
Assuming ascii, then '1' is less than 'a'.
 
When you compare strings you use alphabetical order, or ASCII values of the characters.

numerals ( 0 1 ...) < UPPER CASE LETTERS < lower case letters
 
Willy_B said:
When you compare strings you use alphabetical order, or ASCII values of the characters.

numerals ( 0 1 ...) < UPPER CASE LETTERS < lower case letters

But here we have both numbers and letters. How do you compare a and 1?