big-bang 01
Practice looking at code and making inferences about the types of various functions.
The phrases “signature” and “type signature” mean the same thing.
-
Given the example usage below, write a possible type signature for
d1
.(d1 pic:stick-figure 100 50) => (make-color 100 50 250 255)
-
Write a possible signature for
d2
.(d2 120 "blue") => (place-image pic:book 120 100 (rectangle 200 150 "solid" "blue"))
-
Write a possible signature for
d3
.(define arg (circle 20 "solid" "orange")) (overlay (d3 20 arg "function d3") (circle 60 "solid" "blue"))
-
(a) Write the signature for
k1
given the examples below. (b) Write a purpose fork1
. (c) Write the code for the functionk1
.(k1 pic:scheme-logo 200 320) => (ellipse 200 100 "solid" "red") (k1 pic:bloch 180 130) => (ellipse 180 100 "solid" "red") (k1 (square 74 "solid" "orange") 350 190) => (ellipse 350 100 "solid" "red")
-
The information about a particular animation is given below:
(big-bang pic:bloch (to-draw render-in-sunset) (on-tick d4a 0.5) (on-key d4b))
- Just to make sure: what kind of thing (“type”) is
pic:bloch
? - What is the signature for
render-in-sunset
? - What the name and signature of the tick handler?
- Give the name of the key handler and its signature.
- Just to make sure: what kind of thing (“type”) is