Please follow the standard start-of-class routine.
Warning! You are being recorded (and transcribed) (provided the technology is working correctly).
Approximate overview
CHANGES.txt that describes what you’ve changed.(export ...).Scholarly
Artistic/Cultural
Multicultural
Peer
Musical, theatric, sporting, academic, and similar events involving this section’s students are welcome.
Wellness
Misc
These do not earn tokens, but are worth your consideration.
I have credit for all seven LAs. What should I do during LA time?
You can choose to leave or to work on MP3.
Do we have new work to do over break?
No.
There’s not even a reading due at the end of break.
However, you may find that you want to use break to catch up. For example, you might work on redos, you might try to memorize some “vocabulary”, you might complete some of the labs that you didn’t complete.
I wish we had more time in class to complete labs. Would that be possible?
I try to balance talking with lab time. Some folks need a bit more talking, some need a bit more doing. If you want more lab time, you can always do labs here with a friend and the evening tutors. (Sorry, I know that’s not the best answer.)
I’d like to leave early for fall break. Do I have to show up next Friday?
You will miss the opportunity to take LAs.
You must let me know that you won’t be here.
We’ll all miss you.
But it’s up to you.
Central themes
I can use multiple lists with map, why can’t I use multiple lists with
apply?
Meaning of
mapwith multiple lists
(map fun (list v1 v2 ... vn) (list w1 w2 ... wn))
That becomes
(list (fun v1 w1) (fun v2 w2) ... (fun vn wn))
There’s a natural meaning to
mapwith multiple lists.
On the other hand, consider
(apply fun (list v1 v2 ... vn))
That means
(fun v1 v2 ... vn). How would a second list fit into that meaning?
I’ve written gamma-correct-color, but I struggled to write
gamma-correct-half and gamma-correct-double. The evening tutor
“helped” me write a complicated solution. Can we talk about it? I
think it will help me better understand section and compose.
;;; (gamma-correct-color color gamma) -> color?
;;; color : rgb?
;;; gamma : number?
;;; Gamma correct the color by the given amount. You can read
;;; "the literature" for the details.
;;; (gamma-correct-half canvas) -> canvas?
;;; canvas : canvas?
;;; Gamma correct each of the pixels in `canvas` by 1/2
;;; (gamma-correct-double canvas) -> canvas?
;;; canvas : canvas?
;;; Gamma correct each of the pixels in `canvas` by 2
gamma-correct-half, I need to do something to each pixel
of an image. I know that I can use pixel-map to do so.pixel-map is (pixel-map colorfun image), where
colorfun takes an RGB color as input and returns a new RGB color.gamma-correct is NOT a function of one input.gamma-correct-color
that correct by 0.5 and 2.(define gcc-half
(lambda (color)
(gamma-correct-color color 0.5)))
(define gcc-double
(lambda (color)
(gamma-correct-color color 2.0)))
I can now use pixel-map with those.
(define gamma-correct-half
(lambda (image)
(pixel-map gcc-half image)))
(define gamma-correct-double
(lambda (image)
(pixel-map gcc-double image)))
When you write a procedure by filling in one parameter of a two-parameter
procedure with a constant value, you can also use l-s or r-s.
(define gcc-half
(r-s gamma-correct-color 0.5))
(define gcc-double
(r-s gamma-correct-color 2.0))
Remember that we can always replace a named value with the value.
(define gamma-correct-half
(lambda (image)
(pixel-map (r-s gamma-correct-color 0.5) image)))
(define gamma-correct-double
(lambda (image)
(pixel-map (r-s gamma-correct-color 2.0) image)))
When we have two procedures that look nearly identical, factor out the common portion.
(define gamma-correct-image
(lambda (image amt)
(pixel-map (r-s gamma-correct-color amt) image)))
(define gamma-correct-half
(lambda (image)
(gamma-correct-image image 0.5)))
(define gamma-correct-double
(lambda (image)
(gamma-correct-image image 2.0)))
Important lessons for the quiz:
l-s or r-s. [Useful for thinking about section/compose]map or filter or reduce, it’s often helpful
to build a separate procedure. [Think about this for the lists quiz.]Have Fun!