Welcome to Dr. Racket
Confessions of a Confused Mind
You will have to use a program called Racket extensively to complete "The
Racket Project".
The goal of this "lab" is to get you familiar with the environment. In
the spirit of the assignment, the descriptions are VERY sketchy. (That said, people have succeeded at
this project with less help than I am providing here...)
Please take this in the spirit in which it is intended.
Instructions
- Start the Dr. Racket program. It may be found on machines in the lab(s) or you may download
the Racket version from
from the Racket site.
- Take the Tour through
the second chapter.
- In the lower window, type (car '(3 4 5)). See what you get.
Next, try (cdr '(3 4 5)). Now try
(car (cdr '(3 4 5))). What do car
and cdr do? Can you write an expression that will find the third
item in a list? Does it work if the list has more than three items?
- Now, using the
model from the the tour, turn your expression into a function named
third. Execute it.
- Modify third so that it works even if there are fewer than three items
in the list. (Return nil if there is no item.)
- Finally, write a new function
named Nth that takes a list and a number N and returns
the Nth item in that list (or nil as appropriate).
Congratulations
You are well on the way to learning enough Scheme to complete the project.