# Class 07: Characters and Strings

Back to Numeric Values. On to Procedure Definitions.

This outline is also available in PDF.

Held: Wednesday, January 31, 2007

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

Related Pages:

Notes:

• Any announcements of events your colleagues should attend?
• Any questions on HW4?

Overview:

• Short introduction to strings.
• Lab.

## Numeric Procedures, Revisited

• We'll start with a bit more discussion of what various procedures do.
• 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.
• Integer, real, rational, and complex arguments.

## Different 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
```

## 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 Sep 13 20:54:40 2007.
The source to the document was last modified on Thu Jan 18 12:30:12 2007.
This document may be found at `http://www.cs.grinnell.edu/~rebelsky/Courses/CS151/2007S/Outlines/outline.07.html`.

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

Samuel A. Rebelsky, rebelsky@grinnell.edu

Copyright © 2007 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.