CSC 151 | Grinnell College | Fall, 2005 |

Fundamentals of Computer Science I | ||

CSC 151 requires students to turn in various laboratory exercises. The write-ups for these laboratory exercises should utilize the following formatting conventions:

Answers to all required parts should be typed.

The lab write-up should begin with the names and mailboxes of the students in the group, followed by the number and title of the exercise.

Answers to questions should appear in numerical order (e.g., answer to question 1, then answer to question 2, then answer to question 3, etc.).

While there is no need to repeat the question from a lab, each answer should be clearly numbered; the write-up should make clear which answer goes with what question.

Comments, observations, and explanations should be written as Scheme comments (with lines starting with semicolons).

Code should be written clearly and ready to run.

Sample tests and test results should be given for each required piece of code.

- Exercise 1: Use cons to construct the list (one two three four)
- Exercise 2: Use cons to construct the list (one two three) four)
- Exercise 3: Use cons to construct (((one)))
- Exercise 4 (From Scheme and The Art of Computer Programming by Springer and Friedman) Consider a list ls containing n values. If A evaluates to any value, how many values does the list obtained by evaluating (cons A ls) contain?

Alternatively, in place of the testing components above, you could include the output from the Interpretation window of Dr. Scheme (but be sure that the output you turn in corresponds exactly to your code).;;; Henry M. Walker ;;; Box Y-02 ;;; Sample Lab 1: Format for Required Laboratory Write-ups ;;; Exercise 1 (cons 'one (cons 'two (cons 'three (cons 'four '())))) ;; testing: ;> (cons 'one (cons 'two (cons 'three (cons 'four '())))) ; ===> (one two three four) ;;Exercise 2 (cons 'one (cons (cons 'two (cons 'three '())) (cons 'four '()))) ;; testing: ;> (cons 'one (cons (cons 'two (cons 'three '())) (cons 'four '()))) ; ===> (one (two three) four) ;; Exercise 3 (cons (cons (cons 'one '()) '()) '()) ;; testing: ;this expression generated the desired result ;;; Exercise 4 ;The cons procedure is commonly used to insert an additional element ;at the head of a list. In this exercise, A is a value and ls is a ;list of n elements. Thus, (cons A ls) creates a list of n+1 ;elements: A is first on this new list, with the elements of ls ;following.

This document is available on the World Wide Web as

http://www.math.grin.edu/~walker/courses/151.fa05/labs/lab-format.shtml