posted Oct 14, 2015, 9:14 PM by Samuel Konstantinovich   [ updated Oct 14, 2015, 9:14 PM ]
Goal: List-ception.

Do now:
1. Give an example of an atom (in Scheme)
2. Give an example of something that is not an atom (in Scheme)

Draw a box diagram for the lists below:
'(1 9 3 2)
'(7 5 4 6)

Lists can contain other lists
e1.  '( a b ( c d ) e f)  is a list with 5 top level elements, 4 of them are atoms, 1 is a list.
e2.  '( 1 (2 3) (4 5) ) is a list with 3 top level elements, 1 of them is an atom, 2 are lists.
e3.  '( (a b (c d) e f) ) is a list with 1 top level element that is a list. This list contains the list from example 1.

These can also have box diagrams! (See notes from board)
'(a b (c d) e)

Draw a box diagram for the following lists: (if you want to start with top level elements and work from there that might help.)
L. '(a (b) (c d) e)
M.  '(x (y z) (w q) )
N.  '(a (b (c d) e) f)

Now write a scheme expression with car/cdr that you use on List L to: 
1. extract the (b)
2. extract the b
3. extract the e.
4. extract the d.

What is Recursion? See definition of recursion.