What is the purpose of this table?

  • Thread starter Thread starter MissP.25_5
  • Start date Start date
  • Tags Tags
    Programming
Click For Summary

Discussion Overview

The discussion revolves around the comparison of strings in Scheme programming, specifically focusing on the function that compares the first elements of a list containing both a string and a numeral. Participants explore the implications of ASCII values and alphabetical order in this context.

Discussion Character

  • Technical explanation, Conceptual clarification, Debate/contested

Main Points Raised

  • One participant inquires about the result of a Scheme function that compares the first elements of a list, questioning what those elements are.
  • Another participant suggests that under ASCII, '1' is less than 'a'.
  • Several participants explain that string comparison typically uses alphabetical order or ASCII values, noting the hierarchy of characters.
  • There is a challenge regarding how to compare a letter and a numeral, indicating a potential ambiguity in the comparison process.
  • A link to an ASCII table is provided for reference, suggesting that it may help clarify the comparison of characters.

Areas of Agreement / Disagreement

Participants generally agree on the use of ASCII values for string comparison, but there remains uncertainty regarding the comparison of letters and numerals, indicating a lack of consensus on how to approach this specific case.

Contextual Notes

The discussion does not resolve how to compare a letter and a numeral, and it relies on the assumption that participants are familiar with ASCII values and string comparison in programming.

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?
 

Similar threads

  • · Replies 2 ·
Replies
2
Views
4K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
Replies
7
Views
3K
  • · Replies 13 ·
Replies
13
Views
3K
  • · Replies 10 ·
Replies
10
Views
2K
Replies
1
Views
2K
  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 21 ·
Replies
21
Views
3K