sicp-ex-5.23



<< Previous exercise (5.22) | Index | Next exercise (5.24) >>


meteorgan

  
  
  
 ;;  add those following ev-dispatch 
 (test (op cond?) (reg expr)) 
 (branch (label ev-cond)) 
  
  ev-cond 
  (assign expr (op cond->if) (reg expr)) 
 (goto (label ev-if)) 
  
 ;; add those to eval-operations 
  (list 'cond? cond?) 
 (list 'cond->if cond->if) 

And for let, we can do something similar:

 ;; Add to eval-dispatch 
 (test (op let?) (reg exp)) 
 (branch (label ev-let)) 
  
 ;; add this to eval operations 
 ev-let 
   (assign exp (op let->combination) (reg exp)) 
   (goto (label ev-lambda)) 

let->combination was exercise 4.6