Develop 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.)
Develop 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.
Develop a procedure explode that takes a list as its argument and
returns all of the elements of that list (separately) as values.
> (explode (list 'a 'b 'c 'd)) a b c d > (explode null) ; This expression has no values!
(Hint: Use apply.)
Describe the procedure that is the value of the expression `(compose
string-append explode)'.
Using compose, define and test a predicate that takes a
predicate pred and a list ls as arguments and
returns #t if ls contains more elements that
satisfy pred than elements that do not, #f
otherwise.
This document is available on the World Wide Web as
http://www.cs.grinnell.edu/~stone/courses/scheme/labs/multiple-valued-procedures.xhtml
created March 17, 2000
last revised September 14, 2001
John David Stone (stone@cs.grinnell.edu) and Ben Gum (gum@cs.grinnell.edu)