diff --git a/collects/teachpack/2htdp/scribblings/img-eval.rkt b/collects/teachpack/2htdp/scribblings/img-eval.rkt index 4883d45977..4011fb3b3b 100644 --- a/collects/teachpack/2htdp/scribblings/img-eval.rkt +++ b/collects/teachpack/2htdp/scribblings/img-eval.rkt @@ -1,9 +1,34 @@ #lang racket/base (require scribble/eval) -(provide make-img-eval) +(provide make-img-eval + set-eval-handler-to-tweak-images) + +#| + +make-img-eval : -> (any/c . -> . any) + calls @racket[make-base-eval] to create + an evaluator, and then initializes it with + @racket[set-eval-handler-to-tweak-images]. + + +set-eval-handler-to-tweak-images : (any/c . -> . any) -> void? + + loads @racketmodname[2htdp/image] and @racketmodname[lang/posn] + into the given evaluator and then sets its eval-handler to + increase the bounding box for 2htdp/image images by 1. + + It does this only for images that the result of evaluation + directly (not for example, when lists that contain images + are the result of evaluation). + +|# (define (make-img-eval) (define img-eval (make-base-eval)) + (set-eval-handler-to-tweak-images img-eval) + img-eval) + +(define (set-eval-handler-to-tweak-images img-eval) (interaction-eval #:eval img-eval (require 2htdp/image)) (interaction-eval #:eval img-eval (require lang/posn)) @@ -24,6 +49,4 @@ i)) (current-eval (λ (exp) - (adjust-image exp (ce exp)))))) - - img-eval) \ No newline at end of file + (adjust-image exp (ce exp)))))))