10-21-2013

posted Oct 21, 2013, 5:35 AM by Samuel Konstantinovich   [ updated Oct 21, 2013, 7:09 AM ]
GOAL: Recursion Practice:

Look at your solution for this problem: Write a scheme function that adds up the elements of a list of integers.
e.g.   (sumList 1 2 3) -> 6

Think of a way to implement this:
Write a scheme function that adds up the digits of an integer.
(sumDig 123) -> 6

How do we break up the list into 2 parts?
What are the parts?
How can you break up an integer into two parts?


Recursion techniques,
More problems (GCD)

HW Problem: (myGCD a b)
1. Bring in a printed copy in class tomorrow.
2. Include the Heading + Source Code + Examples you tested it on.

Use Euclids method of finding the GCD we discussed in class.

Write a function (myGCD a b)
for now assume a>b

It returns the greatest common divisor of a and b.
Comments