;; ------------------------------------------------------------------------ ;; | FILE : homework07.rkt | ;; | AUTHOR : [ YOUR NAME ] | ;; | CREATION DATE : [ YOUR DATE ] | ;; | DESCRIPTION : [ YOUR COMMENT ] | ;; ------------------------------------------------------------------------ #lang racket (require "syntax-procs.rkt") (provide curry empty-set set-member? set-add set-union set-subset? free-vars preprocess) ; I provide this from class, for testing ;; -------------------------------------------------------------------------- ;; Problem 1 (structural recursion) ;; -------------------------------------------------------------------------- (define curry (lambda (lambda-exp) 'fill-in-the-blank)) ;; -------------------------------------------------------------------------- ;; Problem 2 (non-recursive solutions) ;; -------------------------------------------------------------------------- (define empty-set (lambda () 'fill-in-the-blank)) (define set-member? (lambda (sym S) 'fill-in-the-blank)) (define set-add (lambda (sym S) 'fill-in-the-blank)) ;; -------------------------------------------------------------------------- ;; Problem 3 (structural recursion) ;; -------------------------------------------------------------------------- (define set-union (lambda (S1 S2) 'fill-in-the-blank)) ;; -------------------------------------------------------------------------- ;; Problem 4 (structural recursion) ;; -------------------------------------------------------------------------- (define set-subset? (lambda (S1 S2) 'fill-in-the-blank)) ;; -------------------------------------------------------------------------- ;; Problem 5 (structural recursion) ;; -------------------------------------------------------------------------- (define free-vars (lambda (exp) 'fill-in-the-blank)) ;; -------------------------------------------------------------------------- ;; preprocess :: full-exp -> core-exp (for use in testing Problem 5) ;; -------------------------------------------------------------------------- (define preprocess (lambda (exp) (cond ( (varref? exp) (make-varref exp) ) ( (lambda? exp) (make-lambda (lambda->param exp) (preprocess (lambda->body exp))) ) ( (app? exp) (make-app (preprocess (app->proc exp)) (preprocess (app->arg exp))) ) ( else ;; let (let ((var (let->var exp)) (val (let->val exp)) (body (let->body exp))) (make-app (make-lambda var (preprocess body)) (preprocess val)) ) )))) ;; --------------------------------------------------------------------------