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.

  1. Given the example usage below, write a possible type signature for d1.

     (d1 pic:stick-figure 100 50)
     => (make-color 100 50 250 255)
    
  2. Write a possible signature for d2.

     (d2 120 "blue")
     => (place-image pic:book 120 100 (rectangle 200 150 "solid" "blue"))
    
  3. Write a possible signature for d3.

     (define arg (circle 20 "solid" "orange"))
     (overlay (d3 20 arg "function d3")
              (circle 60 "solid" "blue"))
    
  4. (a) Write the signature for k1 given the examples below. (b) Write a purpose for k1. (c) Write the code for the function k1.

     (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")
    
  5. 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))
    
    1. Just to make sure: what kind of thing (“type”) is pic:bloch?
    2. What is the signature for render-in-sunset?
    3. What the name and signature of the tick handler?
    4. Give the name of the key handler and its signature.
Last modified August 18, 2023: 2022-2023 End State (7352e87)