More on cons and lists: - Consider the construction (cons 1 2), where the second element of the pair construction is 2 and thus not a list. Then, the call (list? (cons 1 2)) returns false, as there is no trailing empty. That is to say, it is not represented by a list tree, since list tree are always terminated with a trailing 'empty'. However, (pair? (cons 1 2)) returns true, as pair? only requires a cons construction and not a trailing empty. Note also that (symbol? '+) returns true. In the definition of (M-formula_operator fmla) from Asst #4 step 3, we use the conditional structure (cond ((symbol? fmla) ... ) ... but we can equivalently use (cond ((not (pair? fmla)) ...) ... Note that 'fib is a symbol as well. Scheme/LISP Note: - ((+ . 1) . 2) is the old style way of representing the construction (cons (cons + 1) 2). To have DrScheme output the cons form of the construction, make sure to set output mode to 'Constructor" (not 'Write') in the language options. More on Lambda: - Consider the function defined by (define (f x y) ) This is equivalent to (define f (lambda (x y) ) ) where the two 's are identical. The idea here is that in the lambda case, the function represented by lambda is associated with f. So elsewhere in the code, when f is found, it indicates a call to the specified lambda definitions. The arguments x and y are passed on accordingly. More on Testing Code: - In general, you want to construct tests that distinguish the program you intended to write from the one you actually wrote. - In the DEMO, we define an identity_function by feeding the accumulate_list_lr the starting value empty and the accumulation operation (lambda (x y) (append x (list y))). Then, the function should output exactly what we input. Since the application is extremely simple, this test function allows any bugs in the underlying accumulate_list function to become evident.