Computer Science 433
Programming Languages

Fall 2014, The College of Saint Rose

Lecture 10: Recursion and More Advanced Scheme
Date: Monday, September 29, 2014

Agenda

Lecture 10 Assignment

Due at the start of class, Wednesday, October 1.

Please submit answers to these questions in Submission Box under "LA10" or in hard copy by the start of our next class. We will discuss these questions at the start of class, so no late submissions are accepted. Please be sure that your name is clearly indicated in all submissions.

  1. Write a Scheme function called evens which returns all of the even positioned elements of a list. (4 points)

    For example, the function call

    (evens '(a b c d e))
    

    would return the list

    (b d)
    
  2. Write a scheme function called make-lists which takes a list of 2-element lists, each of which contains a positive integer, n, and an atom. It should return a list of list with each interior list representing one of the two element lists with a list consisting of n instances of the atom. (6 points)

    For example, the function call

    (make-lists '((4 dog)(1 cat)(6 cow)))
    

    would return the list

    ((dog dog dog dog) (cat) (cow cow cow cow cow cow))
    

Examples