Functional Problem Solving (CSC 151 2015F) : EBoards
Primary: [Front Door] [Schedule] - [Academic Honesty] [Disabilities] [Email] - [FAQ] [Teaching & Learning] [Grading] [Taking Notes] [Rubric] [Remote Access]
Current: [Assignment] [EBoard] [Lab] [Outline] [Reading]
Sections: [Assignments] [EBoards] [Labs] [Outlines] [Readings] - [Examples] [Handouts]
Reference: [Setup] [VM] [Errors] - [Functions A-Z] [Functions By Topic] - [Racket] [Scheme Report (R5RS)] [R6RS] [TSPL4]
Related Courses: [Curtsinger (2015F)] [Davis (2013F)] [Rebelsky (2015S)] [Weinman (2014F)]
Misc: [Submit Questions] - [SamR] [Glimmer Labs] [CS@Grinnell] [Grinnell] - [Issue Tracker (Course)]
Overview
We expected something like the following.
(define cube (section expt <> 3))
Some of you tried to use *, but each <> is a separate input.
(define fave (irgb 250 0 42))
(irgb-complement fave)
> (irgb->string fave)
"250/0/42"
This problem was to remind you that irgb-complement does not change
fave. Rather, it computes a new color. That's similar to
(define num 5)
(square num)
> num
5
The behavior of irgb-complement and square contrasts a bit with the
kinds of procedures we're playing with today.
Problem 2b
(define fave (irgb 250 0 42))
(define fave2 (irgb-darker (irgb-lighter fave)))
> (irgb->string fave2)
"239/0/42"
An important point from the labs was that irgb-lighter and irgb-darker cap
when you reach the extreme values (0 and 255). So the red component of
(irgb-lighter fave) is 255. When you subtract 16, we end up with 239.
For a latter problem, we've written irgb-rotate-hue to take two parameters
but image-variant expects a procedure that takes only one parameter.
What do we do?
You want to write
(image-variant IMAGE proc); you can't write(image-variant IMAGE irgb-rotate-hue). (Yes, I've just restated your question.)You should know how to turn a two-parameter procedure into a one-parameter procedure by filling in one of the parameters with a value.
If we have two answers that we think are equally good, should we provide both?
Sure.
Do you want examples from interactions, too?
Yes. Copy and paste into definitions pane, and then use "comment out with semicolons."
For the extra credit, what should we do when the chroma is 0?
You should handle that case appropriately, giving a hue of 0.
And you can (should) do that without using an
ifexpression.
The hsv procedure didn't work.
Make sure to run
/home/rebelsky/bin/csc151-updateagain.Computers are sentient and malicious.
Try asking a tutor.