Referenced from lesson Defining Functions
Directions: For each of the following collections of Examples, write the contract for the function above the examples.
-
:: ->examples: big-triangle(100, "red") is triangle(100, "solid", "red") big-triangle(100, "orange") is triangle(100, "solid", "orange") end
-
:: ->examples: purple-square(15) is rectangle(15, 15, "outline", "purple") purple-square(6) is rectangle(6, 6, "outline", "purple") end
-
:: ->examples: banner("Game Today!") is text("Game Today!", 50, "red") banner("Go Team!") is text("Go Team!", 50, "red") banner("Exit") is text("Exit", 50, "red") end
-
:: ->examples: twinkle(5, "outline") is star(5, "outline", "yellow") twinkle(15, "outline") is star(15, "outline", "yellow") twinkle(36, "outline") is star(36, "outline", "yellow") end
-
:: ->examples: half(2) is 2 / 2 half(4) is 4 / 2 half(9) is 9 / 2 end
-
:: ->examples: how-long?("Soccer") is 6 how-long?("Cupcakes") is 8 how-long?("Hi Mom") is 6 how-long?("Cheese pizza") is 12 end
These materials were developed partly through support of the National Science Foundation, (awards 1042210, 1535276, 1648684, and 1738598). Bootstrap:Integrated Oklahoma by Jen Poole is licensed under a Creative Commons 4.0 Unported License. Based on a work at www.BootstrapWorld.org. Permissions beyond the scope of this license may be available by contacting schanzer@BootstrapWorld.org.