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
smiley procedure using the 6P format.Is there a way we can know if our lab write ups are submitted or not? I am confused if my partner in the classroom submitted the writeup or not.
You should ask your partner in the classroom.
Quiz 1: You all had a better process for getting people to be with matching cards. Why didn't you use it?
Quiz 2, Problem 1.
(define d0 (recolor-drawing "blue" drawing-unit-square))
(define d1 (scale-drawing 30 d0))
(define d2 (hshift-drawing 20 d1))
(recolor-drawing "red" d1)
(scale-drawing 1.5 d2)
(image-show (drawing->image (drawing-group d1 d2) 50 50))
Two minutes: Discuss with partner. Then Sam has a series of questions.
How big is the image/canvas we draw?
50x50
After the first expression, (define d0 ...), what is the value of d0?
1x1 square, blue, left boundary is 0, top boundary is 0 (mostly right)
1x1 square, blue, center is at (0,0), left boundary is -0.5 and top boundary is -0.5 (correct)
How could we be more sure?
Look it up in the reading
Try it (visual will be hard, textual will be useful)
Ask someone else (e.g., a mentor or professor)
_After the second expression, (define d1 ...), what is the value of d0?
d0does not change, so it is still 1x1 square, blue, center at (0,0)
_After the second expression, (define d1 ...), what is the value of d1?
d1isd0scaled by 30. 30x30 blue square, left edge at -15, top edge at -15, right edge at 15, bottom edge at 15
_After the third expression, (define d2 ...), what is the value of d0?
Doesn't change
_After the third expression, (define d2 ...), what is the value of d1?
Doesn't change
_After the third expression, (define d2 ...), what is the value of d2?
A 30x30 square, left edge at 5, top edge at -15, right edge at 35, bottom edge at 15
_What is the value of the fourth expression, (recolor-drawing "red" d1)?
A square, centered at (0,0), 30x30, colored red
After the fourth expression, what is the value of d1?
What it was before, a square, centered at (0,0), 30x30, colored blue
What is the value of the fifth expression, (scale-drawing 1.5 d2)?
d2was a 30x30 square, centered at (20,0), left edge at 5, top edge at -15, right edge at 35, bottom edge at 15The value is a 45x45 square, centered at (30,0), left edge at 7.5, top edge at -22.5, right edge at 52.5, bottom edge at 22.5
General principle: You can multiple any of the edges by the scale factor.
What does the final image look like?
;;; Procedure:
;;; create-neighbor
;;; Parameters:
;;; d, a drawing
;;; Purpose:
;;; Create a copy of the drawing, immediately to the right
;;; Produces:
;;; neighbor, a drawing
;;; Preconditions:
;;; [No additional]
;;; Postconditions:
;;; (drawing-left neighbor) = (drawing-right d)
;;; Neighbor is the same appearance as d - same colors, shapes, etc.
;;; (drawing-height neighbor) = (drawing-height d)
;;; (drawing-width neighbor) = (drawing-width d)
;;; (drawing-top neighbor) = (drawing-top d)
max, neighbor, and more.