Approximate overview
Academic
Cultural
Peer
Wellness
Misc
(define square
(lambda (x)
(* x x)))
(define f
(lambda (x)
(square (+ x 1)))
(define g
(lambda (x)
(+ (square x) 1)))
(define p
(lambda (x y)
(- (f x) (g y))))
(define a 3)
(define b 2)
There should be an “S” (for “Satisfactory”) or “Redo” on your quizzes. There are also somoe comments.
I found myself writing the following things multiple time. Please watch these issues. (None of these, by themselves, were enough to move you from Satisfactory to Redo.)
More major issues. These usually lead to Redos.
(square 5) into 25 rather than
first into (* 5 5), or turning (p -4 5) into something other than
(- (f -4) (g 5)).(- (f -4) (g 5)) to (square (+ -4 1)) without
the surrounding context.Note that my concern is less that you got “the right answer” at the end than that you can show how we get there. If you’re skipping steps and writing invalid Scheme, you haven’t shown that you’ll be able to handle more complex evaluation.
Here’s the full derivation as I’d hoped to see it. (I don’t plan to go through it, but you can look for it on the eboard.)
(p (- 8 (* a 4)) (+ (* b b) 1))
--> (p (- 8 (* 3 4)) (+ (* b b) 1))
--> (p (- 8 12) (+ (* b b) 1))
--> (p -4 (+ (* b b) 1))
--> (p -4 (+ (* 2 b) 1))
--> (p -4 (+ (* 2 2) 1))
--> (p -4 (+ 4 1))
--> (p -4 5)
--> (- (f -4) (g 5))
--> (- (square (+ -4 1)) (g 5))
--> (- (square -3) (g 5))
--> (- (* -3 -3) (g 5))
--> (- 9 (g 5))
--> (- 9 (+ (square 5) 1))
--> (- 9 (+ (* 5 5) 1))
--> (- 9 (+ 25 1))
--> (- 9 26)
--> -17
(rgb ...) isn’t working for me.
Did you update our csc151 library?
Did you remember
(require csc151).
What should I see for (rgb ...)?
You should see “color info”. Something like
(color 255 0 128 255).
Why can’t I use (color-red "darksalmon") to get the red component
of the color "darksalmon"?
color-redexpects an RGB (or RGBA) color value, not a string. You need to convert the string (color name) to an RGB color usingcolor-name->rgb.
Will you pass back quizzes?
Yup. As soon as lab starts. (I’ll ask for last names, because I don’t know them.)
A is closest to the board. A drives first. For today’s lab,
Your image should be in the same folder as your .rkt file.
color-name->rgb turns a color name into RGB.
Once you’ve defined ccc and need three concentric circles, you are
much better off calling ccc than rewriting the code.
Good:
(ccc (rgb 255 0 0) (rgb 255 0 255) (rgb 0 0 255))
Bad:
(overlay (circle 10 "solid" (rgb 255 0 0))
(circle 20 "solid" (rgb 255 0 255))
(circle 30 "solid" (rgb 0 0 255)))
(TPS) What are some important things you took from this lab?