[Current] [News] [Glance] [Discussions] [Instructions] [Search] [Links] [Handouts] [Outlines] [Readings] [Labs] [Homeworks] [Quizzes] [Exams] [Examples] [Fall2000.01] [Spring2000]
Scan through the reading on procedures that retun multiple values.
mixed-number-parts
What are the results of applying mixed-number-parts
to
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 call-with-values
.
b. Solve the problem with call-with-values
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
.
[Current] [News] [Glance] [Discussions] [Instructions] [Search] [Links] [Handouts] [Outlines] [Readings] [Labs] [Homeworks] [Quizzes] [Exams] [Examples] [Fall2000.01] [Spring2000]
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 rebelsky@grinnell.edu