;;; File: ;;; anonymous-procedures-lab.scm ;;; Authors: ;;; Samuel A. Rebelsky ;;; Jerod Weinman ;;; YOUR NAME(S) HERE ;;; Summary: ;;; Code for the lab entitled "Anonymous Procedures" ; +--------------------+-------------------------------------------------------- ; | Testing Procedures | ; +--------------------+ ;;; Procedure: ;;; check-drawing ;;; Parameters: ;;; drawing, a drawing ;;; Purpose: ;;; Renders drawing in an appropriately-sized image, making it useful ;;; for testing various drawings. ;;; Produces: ;;; image, an image ;;; Preconditions: ;;; [No additional] ;;; Postconditions: ;;; image is a new image ;;; image contains a rendering of drawing ;;; image is visible on the screen (define check-drawing (lambda (drawing) (image-show (drawing->image drawing (max 100 (inexact->exact (ceiling (drawing-right drawing)))) (max 100 (inexact->exact (ceiling (drawing-bottom drawing)))))))) ;;; Procedure: ;;; check-drawings ;;; Parameters: ;;; drawings, a non-empty list of drawings [unverified] ;;; Purpose: ;;; Renders all the drawings in an image, making it useful ;;; for testing. ;;; Produces: ;;; image, an image ;;; Preconditions: ;;; The check-drawing procedure is defined. ;;; Postconditions: ;;; image is a new image ;;; image contains a rendering of all the drawings in drawings. ;;; image is visible on the screen (define check-drawings (lambda (drawings) (check-drawing (drawing-compose drawings)))) ; +----------+------------------------------------------------------------------ ; | Settings | ; +----------+ (define num-points 50) ; +---------------+------------------------------------------------------------- ; | Sample Values | ; +---------------+ (define numbers (iota num-points)) (define point (drawing-vshift (drawing-scale drawing-unit-circle 5) 100)) (define points (map drawing-hshift (make-list num-points point) numbers))