Functional Problem Solving (CSC 151 2014F) : EBoards
Primary: [Front Door] [Schedule] - [Academic Honesty] [Disabilities] [Email] - [FAQ] [Teaching & Learning] [Grading] [Rubric] - [Calendar]
Current: [Assignment] [EBoard] [Lab] [Outline] [Reading]
Sections: [Assignments] [EBoards] [Examples] [Handouts] [Labs] [Outlines] [Readings]
Reference: [Setup] [VM] [Errors] - [Functions A-Z] [Functions By Topic] - [Racket] [Scheme Report (R5RS)] [R6RS] [TSPL4]
Related Courses: [Davis (2013F)] [Rebelsky (2014S)] [Weinman (2014F)]
Misc: [Submit Questions] - [SamR] [Glimmer Labs] [CS@Grinnell] [Grinnell] - [Issue Tracker (Course)]
Overview
Here are the problems, just in case you want to look at them later.
Q1.
> (map ___ (iota 12))
(1 1/2 1/3 1/4 1/5 1 1/2 1/3 1/4 1/5 1 1/2)
Q2.
(define image-stuff!
(lambda (image x y)
(context-set-fgcolor! "black")
(if (< x (* 1/2 (image-width image)))
(if (< y (* 1/2 (image-height image)))
(image-select-rectangle! image REPLACE x y 10 10)
(image-select-rectangle! image REPLACE x y 10 20))
(if (< y (* 1/2 (image-height image)))
(image-select-rectangle! image REPLACE x y 20 10)
(image-select-rectangle! image REPLACE x y 20 20)))
(image-fill! image)
(image-select-nothing! image)))
Why would anyone ever redefine rgb-redder in this idiotic way?
They wouldn't. However, you will find that there are times that people accidentally redefine a procedure that you are counting on and that breaks your procedure. This exercise is intended to help you think about how you might ameliorate such issues.
No, you don't generally have to code this way. The point is that you can code this way.
Sam also has the "who will sue me because my code doesn't do what I claim" voice in the back of his head.
Can you tell us what's going on in problems 5 and 6?
Yes, but not until Monday, after you think about it a bit.