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!

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

    rcgldr

    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
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted



Similar Discussions: Question about programming
  1. Programming question (Replies: 5)

  2. Programming question (Replies: 6)

Loading...