1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Homework Help: Question about programming

  1. Jul 29, 2013 #1
    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?
  2. jcsd
  3. Jul 29, 2013 #2


    User Avatar
    Homework Helper

    Assuming ascii, then '1' is less than 'a'.
  4. Jul 29, 2013 #3
    When you compare strings you use alphabetical order, or ASCII values of the characters.

    numerals ( 0 1 ...) < UPPER CASE LETTERS < lower case letters
  5. Jul 29, 2013 #4
    But here we have both numbers and letters. How do you compare a and 1?
  6. Jul 29, 2013 #5
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted