sicp-ex-5.9



<< Previous exercise (5.8) | Index | Next exercise (5.10) >>


lockywolf

  
 (compile-lambda ...) 
  

from section 5.5.2 subsection "compiling lambda expressions" doesn't work with this exercise.


meteorgan

  
  
 ;; add a test to make-operation-exp 
 (define (make-operation-exp expr machine labels operations) 
  (let ((op (lookup-prim (operation-exp-op expr) operations)) 
            (aprocs 
                 (map (lambda (e) 
                           (if (label-exp? e) 
                               (error "can't operate on label -- MAKE-OPERATION-EXP" e) 
                               (make-primitive-exp e machine labels))) 
                      (operation-exp-operands expr)))) 
   (lambda () 
           (apply op (map (lambda (p) (p)) aprocs))))) 

codybartfast




(define (make-operation-exp exp machine labels operations)
  (let ((op (lookup-prim (operation-exp-op exp) operations))
        (aprocs
         (map (lambda (e)
                (if (or (register-exp? e) (constant-exp? e))
                    (make-primitive-exp e machine labels)
                    (error "Invalid Argument for operation -- ASSEMBLE" e)))
              (operation-exp-operands exp))))
    (lambda ()
      (apply op (map (lambda (p) (p)) aprocs)))))