2015-10-30 HW15

posted Oct 30, 2015, 6:37 AM by Samuel Konstantinovich   [ updated Oct 30, 2015, 6:37 AM ]
HW15:
Bring a copy to be handed in Monday.
Test the scheme command : append
It is similar to list, and cons. 
1. What does it do?
2. How does it differ from cons and list?
Explain in detail, give examples if you need to. Your goal is to write something that would help a child understand what it does, and how they are different.

Lab-HailLists

1. Write the function (makeHail n)  that creates a list of the hailstone sequence that starts at n. 
(makeHail 8)  returns (8 4 2 1)
(makeHail 3) returns (3 10 5 16 8 4 2 1)

2. How can you reverse a list?
What do we need to do?
Try to write a function that reverses a list:
(reverseL '(1 2 3 4)) returns (4 3 2 1)


Notes from class will help with this. 

Comments