Scan through the reading on procedures that retun multiple values.
What are the results of applying
each of the following values? Explain each result.
What do you expect to happen when you add 2 to the result of
(mixed-number parts 7/5)? Try it and see.
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
b. Solve the problem with
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
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 http://www.cs.grinnell.edu/~rebelsky/Courses/CS151/2000F/Labs/multivalue-proc.html
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 firstname.lastname@example.org