Symbols and Strings - another(among other things The only...

Info icon This preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
Symbols and Strings Symbols versus Strings Scheme provides two types of data for textual information. Symbols consist of a quote mark followed by a sequence of characters (including numbers and many punctuation marks) with no spaces: 'Kathi 'CS1101 and 'hot-dog are examples of symbols. Strings consist of a sequence of characters (including numbers, spaces, returns, and many punctuation marks) enclosed in double quotes: "Kathi" , "CS 1101" and "hot dog" are examples of strings. String and Symbol Operations The best way to get the current list of string operations is to open DrScheme's HelpDesk (under the help menu) and search for string . You'll find contracts and purpose statements for all string operations defined at your current language level. The operations let you compare strings (for equality or alphabetical order), glue them together (also called concatenation), and search for one string inside
Image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: another (among other things). The only operation that specifically handles symbols is checking whether two symbols are the same (using symbol=? ). You cannot perform any operation that requires looking at the characters in the symbol (as alphabetic ordering would require). Which Should I Use? Symbols are good for enumerating a fixed set of choices that you want to represent as words (like 'small , 'medium , 'large ). If you want data that can have a non-standard number of variations, such as names, use strings. You can use punctuation marks to get the effect of space in symbols (as we did with the 'hot-dog symbol). 1101 Home Page . ..to%20Design%20Programs/Notes/08.28%20symbol-string.html [2/5/2008 5:08:00 PM]...
View Full Document

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern