Fundamentals of computer science I

Computer Science 151 is a general introduction to the fundamental ideas of computer science: algorithms, data structures, and abstraction. It includes computer programming (algorithm design, documentation, coding, testing, and debugging) in a high-level programming language, Scheme.

The instructor

John David Stone

Office: Science 2418
Telephone: extension 3181
E-mail: stone@cs.grinnell.edu
Office hours: Mondays, 2:15 to 4:15 p.m.; Tuesdays, 2:15 to 4:15 p.m.; Thursdays, 9 to 11 a.m.; and by appointment.

The textbooks

Springer, George, and Friedman, Daniel P. Scheme and the art of programming. Cambridge, Massachusetts: The MIT Press, 1994. (All the Scheme programs presented in this book, along with solutions to some of the exercises, are available on line. On February 3 I corrected this link, which originally pointed to an unrelated document.)

Kelsey, Richard, Clinger, William, and Rees, Jonathan, eds. Revised5 report on the algorithmic language Scheme. February 20, 1998.

PLT. PLT DrScheme: Programming Environment Manual. November 3, 1999.

You can purchase the Springer and Friedman book at the college book store. Copies of the other two textbooks will be distributed at the first meeting of the class.

Requirements

Here is what each student in the course is expected to do:

You may submit solutions to exercises in hard copy or by electronic mail (to stone@cs.grinnell.edu), including both the text of your Scheme program and one or more test runs, showing the results that your program generates. The on-line document ``Submitting solutions by e-mail'' guides you through the process, step by step.

The deadline for all exercises is 5 p.m. on Tuesday, May 16 (the day before the final examination).

I have prepared a set of sample examination questions, which you may use in preparing for the final. Some of you may find it helpful to take the list of sample questions as a practice exam, allowing yourself the same three-hour period that you'll have on examination day.

There is no preconceived ``grading curve'' for this course. Students do not compete with one another for a fixed quota of As, for example. Instead, I award the grade of A to any student whose work in my (subjective) judgement, is excellent, as specified on page 47 of the 1999-2000 Student Handbook. Similarly, I give Bs for good work, Cs for satisfactory work, and Ds for passing work.

Since you will receive credit on the basis of your individual performance on the exercises and the final examination, it would be unethical to submit any work that is not your own or to collaborate on solutions, arrogating the results of other people's intellectual effort. If I encounter any indications of plagiarism, the Committee on Academic Standing will deal with them.

However, the rule against collaboration does not apply (in this course) to labs, which you may do in pairs if you prefer, or to group study and discussion, except in connection with the exercises.

The schedule

The class is scheduled to meet at 9 a.m. on Mondays, Tuesdays, Wednesdays, and Fridays, from January 24 through March 17 and from April 3 through May 12.

I have been chosen for jury duty in Poweshiek County and may be obliged to miss class on Tuesdays in January and February. You should nevertheless appear at the designated time and work through the lab. A student assistant will answer questions in my absence.

Reading: Springer and Friedman, sections 1.1 and 1.2.

January 24. Getting started. Logging in and out of MathLAN workstations. Starting and shutting down the dtterm terminal emulator. Changing one's password. Starting and shutting down the DrScheme programming environment. Starting and shutting down the Netscape browser. Finding and bookmarking the front-door page for the course.

Reading: Springer and Friedman, section 1.3.

January 25. Beginning Scheme. Procedure calls. The +, -, *, /, expt, and abs procedures. Arithmetic expressions. Definitions.

January 26. Editing Scheme programs. Simple editing operations. Reloading saved programs. The load procedure. Comments

Reading: Springer and Friedman, sections 1.4 and 1.5.

January 28. Symbols and lists.

Reading: Springer and Friedman, sections 2.1 and 2.2.

January 31. Procedure definitions. Lambda-expressions. Procedural abstraction. Booleans and predicates.

Reading: Springer and Friedman, section 2.3.

February 1. Conditional evaluation. If-expressions. Cond-expressions. And-expressions. Or-expressions.

Reading: Springer and Friedman, section 2.4.

February 2. Recursion with lists.

Exercise #1 assigned.

February 4. Recursion with lists (continued).

Reading: Springer and Friedman, section 3.1; Kelsey, Clinger, and Rees, section 6.2.

February 7. Numbers. Natural numbers, integers, ratios, and approximations. Built-in arithmetic procedures.

Reading: Springer and Friedman, section 3.2.

February 8. Recursion with natural numbers.

Reading: Springer and Friedman, sections 4.1 and 4.2.

Exercise #1 due.

February 9. Preconditions and postconditions. Testing preconditions. The error procedure.

February 11. Project #1: Searching for perfect numbers.

Reading: Springer and Friedman, section 4.3.

February 14. Deep recursion.

Reading: Springer and Friedman, section 4.4.

February 15. Pairs and pair structures. Box-and-pointer diagrams. Pair structures. The pair? predicate. Recursion with pair structures.

February 16. Association lists. The assq, assv, and assoc procedures. Using association lists as tables.

Exercise #1 returned. Here's the posted solution.

Exercise #2 assigned.

Reading: Springer and Friedman, sections 5.1 and 5.2.

February 18 and 21. Local bindings. Let-expressions. Let*-expressions.

February 22. Indefinite recursion. Tail-call elimination.

Reading: Springer and Friedman, section 4.5.

Exercise #2 due.

February 23 and 25. Project #2: The martingale.

Reading: Kelsey, Clinger, and Rees, section 4.2.2.

February 28. Local binding and recursion. Letrec-expressions. Named let-expressions.

Reading: Kelsey, Clinger, and Rees, section 6.3.4.

February 29. Characters. Character literals. Character procedures.

Reading: Springer and Friedman, sections 6.1 and 6.2.

March 1. Strings. String literals. Zero-based indexing. String procedures.

Reading: Springer and Friedman, sections 6.3 and 6.4.

March 3. Input and output under program control. Interactive Scheme programs. The read, write, and display procedures. Using symbols as sentinels.

March 6. Outside the interface: Running Scheme programs outside the DrScheme development environment.

March 7. Project #3: Stoichiometry.

Reading: Kelsey, Clinger, and Rees, section 6.6.

March 8. Files. The open-input-file, open-output-file, close-input-port, and close-output-port procedures. Using ports in calls to display, newline, write, and read. The read-char, peek-char, and write-char procedures. The eof-object? predicate. The current-input-port and current-output-port procedures.

Exercise #2 returned. Here's the posted solution.

March 10. Recursion with files. The call-with-input-file and call-with-output-file procedures.

Reading: Springer and Friedman, sections 7.1 and 7.2.

March 13. Procedures as values. The map and apply procedures.

Reading: Springer and Friedman, section 7.3.

Exercise #3 assigned.

March 14. Procedures as values (continued). Operator sections. Filtering.

Reading: Springer and Friedman, sections 7.4 and 7.5.

March 15. Folding.

Reading: Kelsey, Clinger, and Rees, section 4.1.4.

March 17. Variable arity. Alternative forms of the lambda-expression.

April 3 and 4. Multiple-valued procedures. The values and call-with-values procedures. Generalizing procedure composition.

April 5 and 7. Project #4: Genetic drift.

Exercise #3 due.

Reading: Springer and Friedman, sections 9.1, 9.2, and 9.3.

April 10. Vectors. Vector literals. The vector? predicate. The vector and make-vector procedures. The vector-length and vector-ref procedures. The vector-set! procedure.

April 11. Structure mutation. Applications of the vector-set! procedure. The string-set!, set-car!, and set-cdr! procedures.

Reading: Kelsey, Clinger, and Rees, section 4.2.4.

April 12. Iteration. Do-expressions.

Reading: Springer and Friedman, section 9.4.

April 14. Matrices.

Reading: Springer and Friedman, sections 10.1 and 10.2.1.

April 17. Sorting methods. The insertion sort.

Reading: Springer and Friedman, section 10.2.2.

April 18 and 19. The merge sort.

Exercise #4 assigned.

Reading: Springer and Friedman, section 10.3.

April 21. Searching methods. Linear and binary search.

April 24. Records. Constructors, selectors, mutators, type predicates, copiers, identity testers, and displayers.

April 25. Metaprogramming.

Reading: Springer and Friedman, sections 11.1 and 11.2.

April 26. Assignment. Set!-expressions. Global, local, and static variables.

Exercise #4 due.

Reading: Springer and Friedman, sections 12.1 and 12.2.

April 28. Object-oriented programming. Messages. Simple objects.

Reading: Springer and Friedman, section 12.3.

May 1. Stacks. Abstract data types.

May 2. Queues.

May 3. Classes and objects in DrScheme.

May 5. Windowing classes.

Exercise #5 assigned.

May 8. Drawing classes. Canvases and device contexts. Colors. Pens and brushes. Drawing text.

May 9 and 10. Project #5: Plotting.

May 12. Truth and humanity in programming: a sermon. The ACM Code of ethics. Student evaluations.

Exercise #5 due.

Here are the posted solutions to the rest of the exercises:

Wednesday, May 17, 9 a.m. Final examination.

Interesting links

Scheme home page at MIT

schemers.org front-door page

Scheme Repository (Indiana University)

Frequently asked questions about Scheme

The Scheme Underground

Colleges, universities, and secondary schools that use (or are experimenting with) Scheme

Scheme summer workshop at Indiana University (Educational Infrastructure project)


Previous versions of the course

Spring, 1998
Fall, 1997
Spring, 1997


This document is available on the World Wide Web as

http://www.cs.grinnell.edu/~stone/courses/scheme/

created October 24, 1996
last revised May 16, 2000

John David Stone (stone@cs.grinnell.edu)