Advertisement
timothy235

sicp-4-1-4-running-the-evaluator-as-a-program

Mar 12th, 2017
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Racket 0.63 KB | None | 0 0
  1. #lang racket
  2.  
  3. ;;;;;;;;;;
  4. ;; 4.14 ;;
  5. ;;;;;;;;;;
  6.  
  7. ;; Installing map as a primitive procedure does not work because map expects its
  8. ;; first argument to be a Racket procedure, and not one of our M-language procedures,
  9. ;; which is a procedure wrapped in a tagged list.
  10.  
  11. ;; For example, after putting map and + in the primitive procedures list:
  12.  
  13. ;; (driver-loop)
  14. ;; ;;; M-Eval input:
  15. ;; (+ 1 2)
  16. ;; ;;; M-Eval value:
  17. ;; 3
  18. ;; ;;; M-Eval input:
  19. ;; (map + (list 1 2) (list 3 4))
  20. ;; . . map: contract violation
  21.   ;; expected: procedure?
  22.   ;; given: '(primitive #<procedure:+>)
  23.   ;; argument position: 1st
  24.   ;; other arguments...:
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement