> (free-vars '((lambda (x) x) y)) (y) > (bound-vars '((lambda (x) x) y)) (x) > (free-vars '(lambda (x) (y (lambda (y) (y z))))) (y z) > (bound-vars '(lambda (x) (y (lambda (y) (y z))))) (y)
> (free? 'y '(lambda (x) y)) #t > (free? 'x '(lambda (x) x)) #f > (bound? 'x '(lambda (x) x)) #t > (bound? 'y '(lambda (x) y)) #f > (free? 'x '((lambda (x) x) x)) #t > (bound? 'x ((lambda (x) x) x)) #t
For variable references v that are free in the expression,
replace the variable reference with the list (v :
free).
(lexical-address '(lambda (a b c)
(if (eq? b c)
((lambda (c) (cons a c)) a) b)))
(lambda (a b c)
(if ((eq? : free) (b : 0 1) (c : 0 2))
((lambda (c)
((cons : free) (a : 1 0) (c : 0 0))) (a : 0 0))
(b : 0 1)))
Write your answers to the exercises in a file (with comments, following the proper indentation rules), and send that file to
c311@lakshmi.cs.indiana.eduwith the subject line
3Assuming you've saved your homework in the file ``asgn.ss'' in the current directory, one way to submit is with the command:
Mail -s "3" c311@lakshmi.cs.indiana.edu < asgn.ss
Back to the c311 page
ehilsdal@cs.indiana.edu