Warning! You are being recorded (and transcribed) (provided the technology is working correctly).
You should know the start-of-class algorithm
Approximate overview
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.
Where do I submit mini-project 1?
I should have a location on Gradescope ready by Sunday night.
Can I take a makeup for last week’s quizzes?
The one labeled “Decomposition” makes up for the face quiz.
The one labled “Procedures” makes up for the evil building quiz.
Do I need permission to leave to go to the bathroom?
No.
Goals: Explore. Practice writing functions. Practice generalizing.
What is a “subimage”?
It’s something you’ve named and used in the image.
For example, in building a face, you might write
(define nose ...).
Which version of sub3 did people prefer?
It varied. (I also didn’t keep careful count.)
Is there a difference between #(rgb-darker %1) and rgb-darker?
Nope. The first as a longer way to write the second. You should only use cut when you’re filling in some parameters in an expression in order to create a function.
Can you go over Check 4 from the Transforming RGB colors reading
in more depth? I’d like a clearer explanation of why we use composition
here instead of lambda, and how the order of the procedures inside
o affects the result.
Sure. Here’s the question again.
a. Without using
lambda, write a procedure,(rgb-purpler c), that makescredder and bluer.
b. Without using
lambda, write a procedure,(rgb-much-darker c), that appliesrgb-darkerthree times in sequence toc.
Using lambda, we’d solve the first as
(define rgb-purpler (lambda (c) (rgb-bluer (rgb-redder c))))
Using
o, we’d solve the first as(define rgb-purpler (o rgb-bluer rgb-redder))
The composition solution to the first problem does not explictly name the parameter. That can be confusing at first. (You’ll get used to it.)
However, it’s much more concise.
It’s also a different way of thinking. We’re building new functions from old without worrying about a lot of cruft.
Don’t forget to explain how the order of procedures affects the result.
It depends on the procedures you’re using. Let’s look at this one from the self checks.
(define rgb-dl (o rgb-darker rgb-lighter))
Compare that to
(define rgb-ld (o rgb-lighter rgb-darker))
rgb-dlmakes the color lighter and then darker.
Are there colors for which
(rgb-dl color)does not return the same color?
Perhaps “black”
(rgb 0 0 0)and “white”(rgb 255 255 255)
Black stays the same, but white doesn’t.
Since rgb-redder decreases the blue component and rgb-bluer decreases the
red component, won’t rgb-purpler have no effect on the components?
The decrease in blue in
rgb-redderis smaller than the increase in blue inrgb-bluer.
Did the rgb-purpler and rgb-much-darker procedures need to
specifically include parameter c?
Nope. One of the key ideas of composition is that you don’t explicitly mention the parameters.
Can you explain in more details about the color transformations that are not that easy to build?
Some transformations are not naturally built from the existing procedures, such as “add two to red, subtract three from green, and double blue”.
Why doesn’t this work? #(o sub1 (o sub1(o sub1 %1)))
Because …
Usually we use only one
o, such as(o sub1 sub1 sub1)
Of course, we could also write
(o sub1 (o sub1 sub1)). It’s just longer.
But what about that cut (hashtag, octothorpe, pound)?
Compose is supposed to take two functions as parameters. If we call this on a number, we get an error.
Does compose get more parameters?
Nope. Just the one implicit parameter.
I still dont quite understand cutting method.
skipped
The primary idea is that we are “cutting” some values out of an expression, leaving room to fill them in.
For example
(string-append "this" " " "and" " " "that")would give you “this and that”.
To cut out the middle value, making it a parameter, we’d write something like
(define fun1 #("this" " " %1 " " "that")).
That creates a procedure that fills in the middle word.
(fun1 "or")-> “this or that”
(fun1 "but not")-> “this but not that”
If we cut out the end values to make them parameters, we’d write something like
(define fun2 #(%1 " " %1 " " "that"))
Please reload the schedule page before begining the lab.
Make sure that you’re doing “Transforming RGB colors”. If not, reload the schedule page and try again.
Don’t turn anything in today. Plan to do meet with the same partner on Monday to finish this lab and do the next one. (Same place, same partner.)
We will distribute the tracing quiz.
When you are done, give it to Sam and take any makeup quizzes you want.
When you are done, give them to Sam and leave.