Referenced from lesson Defining Functions (Spring, 2021)

Match each set of examples (left) with the contract that best describes it(right).

Examples Contract

(EXAMPLE (f 5) (/ 5 2)) (EXAMPLE (f 9) (/ 9 2)) (EXAMPLE (f 24) (/ 24 2))

1

A

; f :: Number -> Number

(EXAMPLE (f 1) (rectangle 1 1 "outline" "red")) (EXAMPLE (f 6) (rectangle 6 6 "outline" "red"))

2

B

; f :: String -> Image

(EXAMPLE (f "pink" 5) (star 5 "solid" "pink")) (EXAMPLE (f "blue" 8) (star 8 "solid" "blue"))

3

C

; f :: Number -> Image

(EXAMPLE (f "Hi!") (text "Hi!" 50 "red")) (EXAMPLE (f "Ciao!") (text "Ciao!" 50 "red"))

4

D

; f :: Number, String -> Image

(EXAMPLE (f 5 "outline") (star 5 "outline" "yellow")) (EXAMPLE (f 5 "solid") (star 5 "solid" "yellow"))

5

E

; f :: String, Number -> Image

These materials were developed partly through support of the National Science Foundation, (awards 1042210, 1535276, 1648684, and 1738598). CCbadge Bootstrap:Algebra by the Bootstrap Community is licensed under a Creative Commons 4.0 Unported License. This license does not grant permission to run training or professional development. Offering training or professional development with materials substantially derived from Bootstrap must be approved in writing by a Bootstrap Director. Permissions beyond the scope of this license, such as to run training, may be available by contacting contact@BootstrapWorld.org.