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
Office hours: Mondays, 2:15 to 4:15 p.m.; Tuesdays, 10 a.m. to noon; Wednesdays, 9 to 11 a.m.; Thursdays, 2:15 to 4:15 p.m.; or by appointment.

The textbooks

Springer, George, and Friedman, Daniel P. Scheme and the art of programming. Cambridge, Massachusetts: The MIT Press, 1994.

Clinger, William, Rees, Jonathan, et al. Revised4 report on the algorithmic language Scheme. November 2, 1991.

Chez Scheme version 5 system manual. Bloomington, Indiana: Cadence Research Systems, 1994.

The requirements

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

In the determination of final grades, the exercises collectively will count for one-half of your grade, the lab work for one-sixth, the in-class examinations for one-twelfth each, and the final examination for the remaining one-sixth.

Solutions to exercises may be submitted either in hard copy or by electronic mail (to stone@math.grin.edu).

Each exercise carries a deadline, which I expect most students to meet without difficulty. I am usually willing to accept late submissions until I begin returning corrected papers to other students; however, my policy is to judge late papers more strictly than those that come in before the deadline, on the theory that the extra time should be put to good use. I do not award credit for papers submitted after I have begun to return other students' papers.

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

The schedule

The class is scheduled to meet at 9 a.m. on Mondays, Tuesdays, Thursdays, and Fridays, from January 20 through March 14 and from March 31 through May 9.

Reading: Springer and Friedman, sections 1.1 and 1.2.

January 20. Getting started. Logging in and out of MathLAN workstations. Starting and shutting down the hpterm terminal emulator. Changing one's password. Starting and shutting down the Chez Scheme expression evaluator. 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 21. Beginning Scheme. Procedure calls. The +, -, *, /, expt, and abs procedures. Arithmetic expressions. Definitions.

January 23. Editing Scheme files. Starting and shutting down the XEmacs text editor. Opening and saving files in XEmacs. Simple editing operations. The load procedure.

January 24. Scheme within XEmacs. Symbols as values. Quote-expressions. Documentation and strings. Saving .ss files. String literals. Loading a .ss file from the command line.

Reading: Springer and Friedman, sections 1.4 and 1.5 (to page 25).

January 27. Lists: the basics. The cons, car, and cdr procedures. List literals. The empty list. The list, length, reverse, and list-ref procedures.

Reading: Springer and Friedman, section 1.5 (remainder).

January 28. Booleans and predicates. Type predicates: number?, symbol?, list?, null?, and boolean?. Equivalence predicates: eq?, eqv?, and equal?. Arithmetic predicates: =, <, >, <=, >=, even?, odd?, zero?, positive?, and negative?. The not procedure.

Reading: Springer and Friedman, sections 2.1 and 2.2.

January 30. Procedure definitions. Lambda-expressions. The append procedure. Procedural abstraction.

Reading: Clinger et al., section 6.5.

January 31. Numbers in Scheme. The ``tower of subtypes.'' Built-in arithmetic procedures.

Reading: Chez Scheme system manual, sections 3-2 and 3-3.

February 3. Debugging in Chez Scheme. The Chez Scheme debugger.

Reading: Springer and Friedman, section 2.3.

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

Reading: Springer and Friedman, section 2.4.

February 6. Recursion: the basics.

Reading: Springer and Friedman, sections 3.1 and 3.2.

February 7. Variations on recursion. The memq, memv, and member procedures.

Reading: Chez Scheme system manual, section 7-4.

February 10. Random-number generation. The random and random-seed procedures in Chez Scheme.

February 11 and 13. Project: How often must fractions be reduced?

February 14. Detecting errors. Testing preconditions. The error procedure. Recovering from errors under Chez Scheme.

Reading: Springer and Friedman, section 2.5.

February 17. Side effects and sequencing. Output during expression evaluation. The display and newline procedures. Begin-expressions. Tracing by means of output side-effects.

Reading: Chez Scheme system manual, section 3-1.

February 18. Tracing. Procedure definitions with trace-define.

February 20. In-class examination.

Reading: Springer and Friedman, sections 4.1 and 4.2.

February 21. Flat recursion.
Exercise set #1 assigned.

Reading: Springer and Friedman, section 4.3.

February 24. Deep recursion.

Reading: Springer and Friedman, section 4.4.

February 25. Pairs and pair structures. The pair? predicate. Pair structures. The cxr procedures. The assq, assv, and assoc procedures.
Exercise set #1 due.

February 27. Trees. Structural recursion.

Reading: Springer and Friedman, sections 5.1 and 5.2.

February 28. Local bindings. Let-expressions. Let*-expressions.

Reading: Clinger et al., section 4.2.2.

March 3. Local binding and recursion. Letrec-expressions.
Solutions for exercise set #1 released.
Exercise set #2 assigned.

Reading: Springer and Friedman, section 4.5.

March 4. Tail recursion. Named let-expressions.

Reading: Clinger et al., section 6.6.

March 6. Characters. Character literals. The char? predicate. Ordering predicates for characters. The char-alphabetic?, char-numeric?, char-whitespace?, char-upper-case?, and char-lower-case? predicates. The char-upcase and char-downcase procedures.
Exercise set #2 due.

Reading: Springer and Friedman, sections 6.1 and 6.2.

March 7. Strings. String literals. Zero-based indexing. The string? predicate. The string and make-string procedures. The string-length, string-ref, substring, and string-append procedures. Ordering predicates for strings.

Reading: Springer and Friedman, sections 6.3 and 6.4.

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

Reading: Clinger et al., section 6.10.

March 11 and 13. 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.

March 14 and 31 and April 1. Project: Preparing a candidate worksheet.
Solutions for exercise set #2 released.

Reading: Springer and Friedman, sections 7.1 and 7.2.

April 3. Procedures as values. The procedure? predicate. The map, for-each, and apply procedures.
Exercise set #3 assigned.

Reading: Clinger et al., section 5.2.

April 4. Variable arity. Alternative forms of the lambda-expression.

Reading: Springer and Friedman, section 7.3.

April 7. Higher-order procedures. Currying and uncurrying procedures. Operator sections. Procedure composition.

Reading: Springer and Friedman, sections 7.4 and 7.5.

April 8. Procedural abstraction.
Exercise set #3 due.

April 10. In-class examination.

Reading: Clinger et al., sections 6.4 and 6.5.6.

April 11. Conversions. The char->integer and integer->char procedures. The string->number and number->string procedures. The string->symbol and symbol->string conversions.

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

April 14. Vectors: the basics. Vector literals. The vector? predicate. The vector and make-vector procedures. The vector-length and vector-ref procedures.
Solutions for exercise set #3 released.

Reading: Springer and Friedman, section 9.4.

April 15. Structure mutation. The vector-set!, string-set!, set-car!, and set-cdr! procedures.
Exercise set #4 assigned.

Reading: Springer and Friedman, sections 11.1 and 11.2.

April 17. Assignment. Set!-expressions. Global and local variables. Assignments to parameters.

April 18 and 21. Project: Programming the Common Gateway Interface in Scheme.
Exercise set #4 due.

Reading: Clinger et al., section 4.2.4.

April 22. Iteration. Do-expressions.

Reading: Springer and Friedman, sections 10.1 and 10.2.1.

April 24 and 25. Sorting methods. The insertion sort.
Exercise #5 assigned.

Reading: Springer and Friedman, section 10.2.2.

April 28. The merge sort.

Reading: Springer and Friedman, section 10.3.

April 29. Searching methods. Linear and binary search.

May 1. Records. Type predicates. Constructor procedures. Selector procedures. Mutator procedures. Implementating records. Metaprogramming.
Exercise #5 due.

May 2. Scheme libraries. SLIB.

Reading: Springer and Friedman, sections 12.1 through 12.3.

May 5. Object-oriented programming. Messages. Stacks as objects.

May 6 and 8. Project: Kaleidoscope. ELK. The X Windows extensions.
Solutions for exercise set #4 released.

May 9. Summary and review.
Solution for exercise #5 released.

May 12, 9 a.m. Final examination.

Interesting links

Scheme home page at MIT

Revised(4) Report on the Algorithmic Language Scheme

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)


This document is available on the World Wide Web as

http://www.math.grin.edu/courses/Scheme/Stone-index.html

created October 24, 1996
last revised May 28, 1997
John David Stone (stone@math.grin.edu)