Fundamentals of Computer Science I (CSC-151.02 2000F)

Procedures That Return Multiple Values


Exercise 0: Preparation

Scan through the reading on procedures that retun multiple values.

Exercise 1: Testing mixed-number-parts

What are the results of applying mixed-number-parts to each of the following values? Explain each result.

Exercise 2: Computing with Multiple Results

What do you expect to happen when you add 2 to the result of (mixed-number parts 7/5)? Try it and see.

Exercise 3: Tallying By Parity

Define and test a procedure tallies-by-parity that takes any list of integers as its argument and returns two values, the number of even integers in the list and the number of odd integers in the list.

Hint: Use tail recursion.

You may not use partition in your solution.

a. Solve the problem without using call-with-values.

b. Solve the problem with call-with-values

Exercise 4: Separating Association Lists

Define and test a recursive procedure that takes an association list als as argument and returns two results: a list of the keys of als, and a list of the values of als.



Disclaimer Often, these pages were created "on the fly" with little, if any, proofreading. Any or all of the information on the pages may be incorrect. Please contact me if you notice errors.

This page may be found at

Source text last modified Wed Nov 1 10:42:36 2000.

This page generated on Wed Nov 1 10:48:34 2000 by Siteweaver. Validate this page's HTML.

Contact our webmaster at