CS 1101 - Cterm 11

Homework 3 - Basic Lists

Due: Thursday, Feb 3 at 5pm

Read the expectations on homework.

Assignment Goals


The Assignment

Writing Programs over Lists

Imagine that you are writing programs that are part of a word game (like Scrabble or Boggle) in which players get points for the words they can come up with during the game.
  1. Write the data definition for list-of-string. Make at least three examples of lists of strings.

  2. Write the template for a function over a list-of-string.

  3. Write a function got-word? that consumes a list of strings and a string and produces true if the given string occurs at least once in the list.

  4. Write a function all-strings-are-racket? that consumes a list of strings and produces true if every string in the list is the string "racket". The function produces false otherwise. (Hint: the empty case should produce true).

  5. Write a function strings-of-length-n that consumes a list of strings and a number. The function produces a list of only those strings that have the given number of characters.
The functions in problems 3 -5 all follow the list template. The following problem does not follow the list template (make sure you understand why not).
  1. The WPI Registrar keeps track of a student's grades in a single term using this struct definition:
    ;; a grade-report is a struct
    ;; Here is how you make a grade report:
    ;; (make-grade-report symbol symbol symbol)
    (define-struct grade-report (course1 course2 course3))
    
    ;; example
    (define HAMEL-REPORT (make-grade-report 'A 'A 'NR))
    
    Write the function grades-to-list that consumes a grade report and produces a list of symbols that contains each of the grades in the grade report.

What to Turn In

Here is the grading rubric that the TAs will use when they grade Homework 3.

Using web-based turnin, turn in a single file containing all code and documentation for this assignment. Name your file according to the naming conventions for files. Put both partners' names and wpi login names in a comment at the top of the file.