What is the purpose of this table?

  • Thread starter Thread starter MissP.25_5
  • Start date Start date
  • Tags Tags
    Programming
AI Thread Summary
The discussion centers on understanding a Scheme programming function that compares the first elements of two lists. The example provided uses the list (list "apple" "100 yen") to illustrate the comparison. Participants clarify that "a" refers to "apple" and "b" refers to "100 yen," and they discuss the ASCII values of the characters involved in the comparison. It is established that when comparing strings, ASCII values dictate the order, with numerals being less than uppercase and lowercase letters. The conversation concludes with a reference to a table that likely outlines ASCII values for further clarity.
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?
 
Back
Top