Functional Problem Solving (CSC 151 2015S) : EBoards
Primary: [Front Door] [Schedule] - [Academic Honesty] [Disabilities] [Email] - [FAQ] [Teaching & Learning] [Grading] [Taking Notes] [Rubric] - [Calendar]
Current: [Assignment] [EBoard am] [EBoard pm] [Lab] [Outline] [Reading]
Sections: [Assignments] [EBoards am] [EBoards pm] [Labs] [Outlines] [Readings] - [Examples] [Handouts]
Reference: [Setup] [VM] [Errors] - [Functions A-Z] [Functions By Topic] - [Racket] [Scheme Report (R5RS)] [R6RS] [TSPL4]
Related Courses: [Davis (2013F)] [Rebelsky (2014F)] [Weinman (2014F)]
Misc: [Submit Questions] - [SamR] [Glimmer Labs] [CS@Grinnell] [Grinnell] - [Book Office Hours] - [Issue Tracker (Course)]
Overview
Admin
Consider the following sequence of definitions
(define d1 (hshift-drawing 50 drawing-unit-circle))
(define d2 (hshift-drawing 20 drawing-unit-square))
(define d3 (scale-drawing 5 (drawing-group d1 d2)))
(recolor-drawing d2 "red")
(define d4 (scale-drawing 20 d1))
(image-show (drawing->image (drawing-group d3 d4) 100 50))
Sketch the result
The "simple geometric center" of a drawing is the point horizontally
midway between the left edge and the right edge of the drawing, and
vertically midway between the top edge and the bottom edge of the
drawing. Recall that there is no drawing-bottom or drawing-right
procedure. Sketch the code you would use to find the x coordinate of
the center of drawing my-drawing. (You don't know the definition of
that drawing.)
(define center-x
(+ (/ (drawing-width my-drawing) 2)
(drawing-left my-drawing)))