Computer Science 433
Programming Languages

Fall 2012, The College of Saint Rose

Lecture 14: More Advanced Scheme
Date: Wednesday, October 17, 2012

Agenda

Lecture Assignment 14

Due at the start of class, Monday, October 22.

Please submit answers to these questions either as a hard copy (typeset or handwritten are OK) or by email to terescoj AT strose.edu by the start of class. Please use a clear subject line when submitting by email (e.g., CSC 433 Lecture Assignment 14, Joe Student). We will discuss these questions at the start of class, so no late submissions are accepted.

  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