2014-10-15 + HW13

posted Oct 15, 2014, 7:27 AM by Samuel Konstantinovich   [ updated Oct 15, 2014, 10:11 AM ]
Do Now:

Evaluate (fact 5)  by expanding the function. 
Do this by writing a new line and replacing every instance (fact n) with the result from the if statement. 
-If that line has fact in it, replace that in the next line.
-Do this until there are no more function calls to replace. (You should now have a series of multiplications)


HW13 (printed on paper, brought in tomorrow)

Consider the exponent function (exponent base power)
assume:  if the base is 0, the exponent must be positive.

-This must be done recursively, so there is at least one base case and one recursive call.
1-What are the different cases you must consider?
2-Identify if those cases are recursive, or a base case.
3-Write the function in racket  (you can print from drRacket, or paste into another program) 
4-Write some test cases and show the results. (include negative exponents that you know the answer to)
5-Don't forget your heading!
Comments