Functional Problem Solving (CSC 151 2016S) : EBoards
Primary: [Front Door] [Schedule] - [Academic Honesty] [Disabilities] [Email] - [FAQ] [Teaching & Learning] [Grading] [Taking Notes] [Rubric]
Current: [Assignment] [EBoard] [Lab] [Outline] [Reading]
Sections: [Assignments] [EBoards] [Labs] [Outlines] [Readings] - [Examples] [Handouts]
Reference: [Setup] [Remote] [VM] [Errors] - [Functions A-Z] [Functions By Topic] - [Racket] [Scheme Report (R5RS)] [R6RS] [TSPL4]
Related Courses: [Curtsinger (2016S)] [Davis (2013F)] [Rebelsky (2015F)] [Weinman (2014F)]
Misc: [SamR] [Glimmer Labs] [CS@Grinnell] [Grinnell] - [Issue Tracker (Course)]
Overview
(define fave (irgb 250 0 42))
(define fave2 (irgb-lighter (irgb-darker fave)))
(irgb-complement fave)
(irgb->string fave).(irgb-complement fave) does not change fave; it just computes
a new colorThe last problem: Write a procedure that adds 32 to each component.
Three possible strategies:
lambda.section.compose.We need to use compose.
(define irgb-much-lighter (compose irgb-lighter irgb-lighter)) ; not allowed
(define irgb-much-lighter (compose irgb-redder irgb-greener irgb-bluer))
(define irgb-much-lighter (compose irgb-complement irgb-darker irgb-darker irgb-complement))
Similar questions were in the mentor sessions and in the notes. (And no, we did not intend to give a particular advantage to those folks.)
Can we write define in the middle of a procedure?
No.
Did you even look at what you wrote for problem 4?
I thought so. I'll fix it during class.
How much info should we provide when citing other groups?
Approximately: "I talked to Tulah's Two Taylors about problem 4 and they provided me with advice on it."
How should we cite code from the assignment?
I don't require you to cite code from assignments.
If you choose to cite such code, use something like "Taken from assignment 3 at http://www.cs.grinnell.edu/~rebelsky/Courses/CSC151/2016S/assignments/assignment.03.html."
Or
Curtsinger, C., Davis, J., Rebelsky, S. A., and Weinman, J. (2016).
_Assignment 3: Color Transformations and Image Filters._ Grinnell
College, Dept. of CS. Online document at
<http://www.cs.grinnell.edu/~rebelsky/Courses/CSC151/2016S/assignments/assignment.03.html>, last modified 2016-02-01; visited yesterday.
How can we wrap around given that the remainder function doesn't take decimals?
Option 1: Round to the nearest integer.
Option 2: Use a more clever calculation.
(define square (lambda (num) (* num num)))
(define square (lambda (renn) (* renn renn)))
(define square (lambda (color) (* color color)))
Scheme doesn't care what you call your parameters! So choose a name that makes sense to your human reader.
Be careful about what you name your parameters, as they can override existing names.
(define square
(lambda (*)
(* * *)))
(define square
(lambda (+)
(* + +)))
Ugh.
Writeup: 3 ab and 5