CS323: Programming Languages and Methodologies
Homework Project 2
Assigned April 11
Due in class Wednesday April 18


1. Write a Scheme function "break-up", that takes a number n in decimal form and returns a list of digits that make up the number.
(break-up 7) is (7)
(break-up 137) is (1 3 7)

2. Write a predicate (find? x n) that returns #t if the digit x occurs in the decimal representation of n, and #f otherwise.

3. Write a Scheme function that will "reverse-digits". The procedure takes a number n in decimal form and returns another integer that is written in decimal form with digits reversed.
(reverse-digits 7) is 7
(reverse-digits 12453) is 35421

4. Write a Scheme function that computes the "shuffle", that is takes two numbers a and b, written in decimal and returns a new number that shuffles the two numbers together.
(shuffle 12 34) is 1324
(shuffle 123 456) is 142536

5. A perfect number is one that is equal to the sum of its divisors. Write a Scheme function predicate (perfect? n).
(perfect? 6) is #t since 6 = 1 + 2 + 3
(perfect? 8) is #f since 8 is not = 1 + 2 + 4
(perfect? 28) is #t since 28 is = 1 + 2 + 4 + 7 + 14