MIT 6.001 Fall, 1997 Instructor: A. Meyer Recitation #7, Notes for Wed., 11/19/97 CLASS EXERCISE: In presenting today's 5 min Problem #15, Jason only had time to show the left-to-right solution. Use the same idea to define the right-to-left solution. SOLUTION: See REC-PROB15 For the rest of recitation, we discussed the Scheme values used by the PS8 interpreter to represent the values of extended Scheme, which now include DELAYED-VALUES as well as a new class of procedures with one or more lazy or lazy-memo parameters. EXTENDED-SCHEME VALUE REPRESENTED BY self-evaluating (eg, #t, 3.2) itself (viz, #t, 3.2) compound-procedure (compound-procedure-tag params body env) primitive-procedure Scheme procedure (primitive or compound) list of val1 ... valn list of representations of val1 ... valn delayed value (*lazythunk* ) So the Scheme procedure MPAIR? which implements the PS8 interpreter's primitive PAIR? procedure should return true iff its argument is a Scheme pair which does NOT begin with COMPOUND-PROCEDURE-TAG: (define (mpair? rep) (and (pair? rep) (not (compound-procedure? rep)))) where (define (compound-procedure? rep) (and (pair? rep) (not (eq? (car rep) compound-procedure-tag))))