Referenced from lesson Contracts (Spring, 2021)
Consider the following contract:
is-beach-weather :: Number, String -> Boolean
1 What is the Name of this function?
2 How many arguments are in this function’s Domain?
3 What is the type of this function’s first argument?
4 What is the type of this function’s second argument?
5 What is the Range of this function?
6 Circle the expression below that shows the correct application of this function, based on its contract.
-
is-beach-weather(70, 90)
-
is-beach-weather(80, 100, "cloudy")
-
is-beach-weather("sunny", 90)
-
is-beach-weather(90, "stormy weather")
Consider the following contract:
cylinder :: Number, Number, String -> Image
7 What is the Name of this function?
8 How may arguments are in this function’s Domain?
9 What is the type of this function’s first argument?
10 What is the type of this function’s second argument?
11 What is the type of this function’s third argument?
12 What is the Range of this function?
13 Circle the expression below that shows the correct application of this function, based on its contract.
-
cylinder("red", 10, 60)
-
cylinder(30, "green")
-
cylinder(10, 25, "blue")
-
cylinder(14, "orange", 25)
These materials were developed partly through support of the National Science Foundation,
(awards 1042210, 1535276, 1648684, and 1738598).
Bootstrap:Integrated Oklahoma 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.