Warning! You are being recorded (and transcribed) (provided the technology is working correctly).
Approximate overview
(define kitten (image-load "kitten.jpg")) in your definitions
pane, the autograder will crash. That’s because it’s going to try
to load “kitten.jpg”.
Academic/Scholarly
Cultural
Peer
Wellness
Misc
Why can’t I see how I’m doing with tokens?
Because Sam hasn’t tallied them yet. Stay tuned.
Can you further explain how the computer understands/executes the cut
procedure?
First of all,
cutisn’t strictly a procedure. It’s a “keyword” (at least as I describe it). Instead of evaluating its parameter, which is the norm for procedures, it transforms its parameter into a procedure.
Basically, it creates a parameter for each diamond/hole at the top level of the expression and then makes a procedure out of it.
Can cut or section be used such that one parameter is used twice?
Neither
cutnorsectionlets you duplicate a parameter. Hence, they have somewhat limited use. They are still useful in a large range of situations.
For check one, I tried to make this work:
(define sub3 (sub1 (sub1 (cut (sub1 <>)))))
But it gave me an error saying the second sub1 wasn’t receiving a
number for an input but (cut (sub1 <>)) does output a number. Why
doesn’t that code work?
Can you really put
cutin the middle of an expression?
cutdoesn’t work when you have a nested expression.
Maybe we need to rearrange.
How
defineworks: We evaluate the expression and then associate it with the identifier.
We’re going to try to evaluate
(sub1 (sub1 (cut (sub1 <>)))).
If we were to going to evaluate
(sub1 (* 2 3)), we’d multiply the 2 by the 3, giving us(sub1 6). And we’d then evaluate the(sub1 6), giving us 5.
Racket will do the same with this expression above.
“I have a sub1. What’s the parameter? Oh, it’s another sub1. What’s the parameter? Oh, it’s a cut. Let’s see … we build another procedure.”
(sub1 (sub1 #<procedure>))
When we try to apply
sub1to a procedure, we get the error message.
In general, Racket is aggressive about evaluating expressions/procedure calls, only a few things (like
lambdaandcut) delay that evaluation.
“It will make more sense as you get used to it.”
This is just
(sub1 (sub1 sub1))
What’s the difference between (cut (rgb-darker <>)) and rgb-darker?
They work the same.
The
cutis longer to write.
I discovered that I can’t put a diamond in a nested expression, such
as (cut (+ 2 (* 3 <>))). Why not?
Option 1: The person who implemented
cutwasn’t clever enough to do that.
Option 2: The person who implemented
cutwas too lazy to do that.
Option 3: The person who implemented
cutthought it wasn’t necessary and wanted students to explore other approaches.
We can break that up. The goal here is “multiply by 3 and then add 2”.
We can write “multiply by three” as
(cut (* 3 <>)).
We can write “add two” as
(cut (+ 2 <>)).
When we want to do one thing and then another we use composition.
So we could write
(o (cut (+ 2 <>)) (cut (* 3 <>))).
Can we write (+ 2 (cut (* 3 <>)))?
No. Because
(cut (* 3 <>))is a procedure. So you’re writing(+ 2 #<procedure>). It doesn’t make sense to DrRacket to add to a procedure.
Computers are dumb. You may know what you’re saying. It can’t figure it out.
I couldn’t find any colors for which (o rgb-darker rgb-lighter) gave
a different color. Are there any?
Yes.
(rgb 255 255 255) ; white
(rgb 255 0 0) ; red
> (rgb->string (rgb-lighter (rgb 255 0 0)))
"255/16/16"
> (rgb->string (rgb-darker (rgb-lighter (rgb 255 0 0))))
"239/0/0"
> (rgb->string (rgb-darker (rgb-lighter (rgb 242 243 244))))
"239/239/239"
For very bright components, lighter and darker are not complete inverses.
Could you go over rgb-purpler and rgb-much-darker?
Sure.
(define rgb-purpler (o rgb-redder rgb-bluer)).
Can you show how to load an image in DrRacket? I’m getting errors.
Sure.
Your Racket file needs to be in the same directory as your image.
Can we put a longer path in image-load?
Yes. But not for something you’re submitting on Gradescope.
Can you ever finish the introductory material promptly?
Yes, but not if I try to answer all the questions.
Last semester’s class said that it’s more important to answer all the questions.
Oh, cool. I can copy colors and images into the definitions pane!
You can, but please don’t. It makes the file unreadable on Gradescope.
I didn’t finish the lab and it seems really important for the SoLA.
It is. You should try it on your own. DM me on Teams when you have questions.
Why doesn’t greyscale just average the three components?
Because the color theory I looked up suggests that we perceive green as contributing more than blue or red.
The formula I use is
(+ (* .3 red-component) (* .11 blue-component) (* .59 green-component))