Key to CSE341 Section #6 Problems 1. Recall that the correct definition is: (define (fact n) (if (= n 0) 1 (* n (fact (- n 1))))) The errors are as follows: (define (fact n) (if (= n 0) (1) (* n (fact (- n 1))))) (1) is not a function (define (fact n) (if = n 0 1 (* n (fact (- n 1))))) the if has 5 arguments (define fact (n) (if (= n 0) 1 (* n (fact (- n 1))))) bad define with 3 arguments instead of 2 (define (fact n) (if (= n 0) 1 (* n fact (- n 1)))) the call on * includes fact as if it were a number (define (fact n) (if (= n 0) 1 (* n ((fact) (- n 1))))) (fact) is a bad call 2. This information can be found in the R5RS standard. For the question about comments, go to the index and look up "comment" to find that Scheme has only single-line comments. Anything after a semi-colon is considered a comment. In evaluating (/ a b c d), the standard says "associating to the left", which means it is evaluated as (((a / b) / c) / d). Looking through the index for things that begin with "string", you'll find a function string i n) () (cons (* i m) (explore (+ i 1))))) (explore 1)) 6. One possible solution appears below. (define (flatten lst) (if (null? lst) () (if (list? (car lst)) (append (flatten (car lst)) (flatten (cdr lst))) (cons (car lst) (flatten (cdr lst))))))