# Procedures That Return Multiple Values

## Exercises

### 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.

• 17/5
• 4/7
• 40/2
• -2/5
• -10/3
• 1.3
• -0.5

### 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`.

## History

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.