- Complete the following Scheme definition (replace the "..."):
(define (ex1 v1 v2) (let ([f ...]) (begin (f v1) (f v2))))

so that the value of`(ex1`is*n**m*)for any integers*n*m*and*n*. The catch is that neither*m*`v1`nor`v2`may appear in anywhere within the expression replacing "...".

- Complete the following Scheme definition (replace the "..."):
(define (ex2 v1 v2) (let ([mk ...]) (let ([f (mk)] [g (mk)]) (begin (g v1) (f v2) (g 1)))))

so that the value of`(ex2`is*n**m*)for any integers*n*and*n*. As always, neither*m*`v1`nor`v2`may appear in anywhere within the expression replacing "...".

- Complete the following Scheme definition (replace the "..."):
(define (ex3 v1 v2) (let ([mk ...]) (let ([f (mk)] [g (mk)]) (begin (f v1) (g v2) (g 1)))))

so that the value of`(ex3`is*n**m*)for any integers*n*m*and*n*. As before, neither*m*`v1`nor`v2`may appear in anywhere within the expression replacing "...".

- Complete the following Scheme definition (replace the "..."):
(define (ex4 v1 v2 v3 v4) (let ([mk ...]) (let ([f (mk)] [g (mk)]) (begin (f v1 v2) (g v3 v4) (list (f 1 1) (g 1 1))))))

so that the value of`(ex4`is*n**m**p**q*)`(list`for any integers*n*m*q**m*p*q*),*n*,*m*, and*p*. Of course,*q*`v1`,`v2`,`v3`, or`v4`may not appear in anywhere within the expression replacing "...".

Last update: Monday, October 8th, 2001mflatt@cs.utah.edu |