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: weekdays, 2:30 to 4:15, 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.

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@math.grin.edu). The deadline for all exercises is noon on Friday, December 19; I'll try to read and comment on any solutions that I receive after this deadline, but they will not be eligible for credit.

I have arranged the exercises in a sequence. Your final grade will be determined by how far you get in this sequence -- that is, by the number of complete and correct solutions you submit, with the additional provision that you are eligible to receive credit for exercise n + 1 only if you have submitted a complete and and correct solution for exercise n.

You may turn in as many incomplete or tentative solutions as you like; I shall make comments and suggestions on them, but award credit only for solutions that are complete, correct, and in sequence.

Note that under these rules it would be extremely imprudent to wait until the last week of the semester and then submit a large bundle of solutions.

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 shall award the grade of A to any student who completes the number of exercises that, in my (subjective) judgement, constitutes excellent work in the course, as specified on page 5 of the 1997-1998 Student Handbook. Similarly, I'll give Bs for good work, Cs for satisfactory work, and Ds for passing work.

For the benefit of those who are motivated by competition, however, here is a list of the exercises, indicating how many members of the class have so far completed each one:

Since you will receive credit on the basis of your individual performance on the exercises, 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 10 a.m. on Mondays, Wednesdays, Thursdays, and Fridays, from August 28 through October 17, from October 27 through November 26, and from December 1 through December 12.

Reading: Springer and Friedman, sections 1.1 and 1.2.

August 28. 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 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.

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

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

September 3. 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.

September 4. Lists, Booleans, and predicates. The cons, car, and cdr procedures. List literals. The empty list. The list, length, reverse, append, and list-ref procedures. 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.

September 5. Procedure definitions. Lambda-expressions. Procedural abstraction.

Reading: Clinger et al., section 6.5.

September 8. Numbers. The ``tower of subtypes.'' Built-in arithmetic procedures.

Reading: Springer and Friedman, section 2.3.

September 10. Conditional evaluation. Cond-expressions. If-expressions. And-expressions. Or-expressions.

Reading: Springer and Friedman, section 2.4.

September 11. Recursion: the basics.

Reading: Springer and Friedman, sections 3.1 and 3.2.

September 12 and 15. Variations on recursion. The memq, memv, and member procedures.

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

September 17. Random-number generation. The random and random-seed procedures in Chez Scheme.

September 18. Detecting errors. Testing preconditions. The error procedure.

September 19. Project: How often does the best team win?

Reading: Springer and Friedman, section 2.5.

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

Reading: Springer and Friedman, sections 4.1 and 4.2.

September 24. Flat recursion.

Reading: Springer and Friedman, section 4.3.

September 25. Deep recursion.

Reading: Springer and Friedman, section 4.4.

September 26. Pairs and pair structures. The pair? predicate. Pair structures. Box-and-pointer diagrams. The assq, assv, and assoc procedures.

September 29. Trees. Structural recursion.

Reading: Springer and Friedman, sections 5.1 and 5.2.

October 1. Local bindings. Let-expressions. Let*-expressions.

October 2. Project: The prisoner's dilemma.

October 3. Project: The prisoner's dilemma (continued).

Project: The prisoner's dilemma (continued): Results of the second tournament.

Reading: Clinger et al., section 4.2.2.

October 6. Local binding and recursion. Letrec-expressions.

Reading: Springer and Friedman, section 4.5.

October 8. Tail-call elimination. Named let-expressions.

Reading: Clinger et al., section 6.6.

October 9. 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.

Reading: Springer and Friedman, sections 6.1 and 6.2.

October 10. 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.

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

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

October 15. Debugging in Chez Scheme. The Chez Scheme interactive inspector.

October 16 and 17. Project: Formatting and writing real numbers.

Reading: Clinger et al., section 6.10.

October 27. 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.

October 29. Files (continued). The call-with-input-file and call-with-output-file procedures. The current-input-port and current-output-port procedures.

Reading: Springer and Friedman, sections 7.1 and 7.2.

October 30. Procedures as values. The procedure? predicate. The map, for-each, and apply procedures.

October 31. Procedures as values (continued).

Reading: Clinger et al., section 5.2.

November 3. Variable arity. Alternative forms of the lambda-expression.

Reading: Springer and Friedman, sections 7.3 through 7.5.

November 5. Higher-order procedures. Operator sections. Currying. Procedure composition.

November 6 and 7. Project: Constructing World Wide Web documents.

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

November 10. Vectors: the basics. Vector literals. The vector? predicate. The vector and make-vector procedures. The vector-length and vector-ref procedures. The vector-set! procedure.

Reading: Springer and Friedman, section 9.4.

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

Reading: Springer and Friedman, sections 11.1 and 11.2.

November 13. Assignment. Set!-expressions. Global and local variables. Assignments to parameters.

November 14. Scheme libraries. SLIB.

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

November 17. Conversions. The char->integer and integer->char procedures. The string->number and number->string procedures. The string->symbol and symbol->string conversions.

Reading: Clinger et al., section 4.2.4.

November 19. Iteration. Do-expressions.

November 20 and 21. Project: Plotting a function.

Reading: Springer and Friedman, sections 10.1 and 10.2.1.

November 24. Sorting methods. The insertion sort.

Reading: Springer and Friedman, section 10.2.2.

November 26. The merge sort.

Reading: Springer and Friedman, section 10.3.

December 1. Searching methods. Linear and binary search.

December 3. Records. Type predicates. Constructor procedures. Selector procedures. Mutator procedures.

December 4. Metaprogramming.

Reading: Springer and Friedman, sections 12.1 and 12.2.

December 5. Object-oriented programming. Messages. Simple objects.

Reading: Springer and Friedman, section 12.3.

December 8. Stacks and queues. Abstract data types.

December 10 and 11. Project: The virtual pet.

December 12. Summary and review.

Interesting links

Scheme home page at MIT

Revised4 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)

Previous versions of the course

Spring, 1997


This document is available on the World Wide Web as

http://www.math.grin.edu/~stone/courses/scheme/

created October 24, 1996
last revised December 26, 1997

John David Stone (stone@math.grin.edu)