Ithaca College Logo Ithaca College Home Blue Header

Ithaca College, Ithaca, New York
*

Practicum 3

Due: Thursday, 14 February, beginning of class.


Objectives:

Reference: The Scheme Programming Language, R. Kent Dybvig, Addison-Wesley, 2003.


Requirements:


Practicum:

  1. Define a function called highest that takes as its arguments a number x and a list of numbers, ls. The list may contain numbers and lists of numbers. You must return a list that contains all numbers in ls that are greater than x. If the list contains a list, your answer must contain that same list (but, of course, that list must contain only numbers greater than x. Test data:
  1. Define a function sandwich-1st that takes three paramters, two items, x and y, and a list, ls. Replace every occurrence of two successive y's with y x y. Note that your halting condition will be more complicated. You'll have to detect both an empty list and a list with only one item. You may assume that there are no lists nested inside the parameter ls. Test your function on:
  1. Now expand your function sandwich-lst to a new function sandwich2-lst that works when the parameter ls may contain lists. Test your function on the following examples.


Last updated on 14 Feb 2008 by John Barr