# Class 07: Characters and Strings

Back to Numeric Values. On to Procedure Definitions.

This outline is also available in PDF.

Held: Tuesday, 5 September 2006

Summary: Today we consider two of Scheme's core data types: Characters and strings.

Related Pages:

Due

Assignments

Notes:

• Pairs continue from yesterday.
• More extra credit this week: Tuesday extra (Today 12:45-2:00 p.m. in Science 2424), Convo (11-noon, Thursday, Herrick).

Overview:

• Short introduction to strings.
• Lab.

## Lessons from Yesterday

• Think about the arrangement of windows on the screen.
• Think about how you interact with DrScheme. There are a variety of techniques in use, and you might find that a different one does better for you.
• Type the expressions in the bottom window and look at results.
```> (real? 3/4)
#t
> (rational? 3/4)
#t
```
• Type the expressions in the top window, click "Run", and look at results.
```(real? 3/4)
(rational? 3/4)
RUN
#t
#t
```
• Name the expressions in the top window, click "Run", and query results
```(define ex1a (real? 3/4))
(define ex1b (rational? 3/4))
RUN
> ex1a
#t
> ex1b
#t
```
• Intersperse symbols that indicate what you're computing
```'is-three-forths-real?
(real? 3/4)
'is-three-forths-rational?
(rational? 3/4)
RUN
is-three-forths-real?
#t
is-three-forths-rational?
#t
```
• Think about how you explore procedures. If you are exploring a numeric procedure, you should certainly try:
• Different numbers of arguments.
• Both positive and negative arguments.
• Both exact and inexact arguments.
• Real, rational, and complex arguments.

## Characters and Strings

• Characters: The building blocks of strings
• Strings: Collections of characters
• Together: The basics types for input and output in Scheme

## Lab

• Do as much of the lab as you can.
• Be prepared to reflect.

Back to Numeric Values. On to Procedure Definitions.

Disclaimer: I usually create these pages on the fly, which means that I rarely proofread them and they may contain bad grammar and incorrect details. It also means that I tend to update them regularly (see the history for more details). Feel free to contact me with any suggestions for changes.

This document was generated by Siteweaver on Thu Nov 30 21:43:20 2006.
The source to the document was last modified on Mon Sep 4 08:43:32 2006.
This document may be found at `http://www.cs.grinnell.edu/~rebelsky/Courses/CS151/2006F/Outlines/outline.07.html`.

You may wish to validate this document's HTML ; ;

Samuel A. Rebelsky, rebelsky@grinnell.edu

Copyright © 2006 Samuel A. Rebelsky. This work is licensed under a Creative Commons Attribution-NonCommercial 2.5 License. To view a copy of this license, visit `http://creativecommons.org/licenses/by-nc/2.5/` or send a letter to Creative Commons, 543 Howard Street, 5th Floor, San Francisco, California, 94105, USA.