Assignments Due

Notes and Questions

Is it better to solve problems by thinking about what we need to do to solve the problem (procedures) or by thinking about what we need to represent to solve the problem (data)?





A Pair packages two data values together. The built-in procedures for manipulating Pairs include:

What does (car (cons x y)) evaluate to?


What does (cdr (cons x y)) evaluate to?


What is the value of (car (cdr (cons 1 (cons 2 (cons 3 null)))))?


Why do we need the special list null?




How could we define cons, car and cdr if Scheme did not have them as primitives?





Are there any data structures that cannot be built using just cons?









A List is either (1) null or (2) a Pair whose second cell is a List.

Why should we be especially optimistic that we can define a recursive procedure to operate on a list?





Define list-trues as a procedure that takes a list as its input and evaluates to the number of non-false values in that list.