Referenced from lesson Defining Functions
Directions: For each of the following collections of Examples, write the contract for the function above the examples.
-
; : ->(EXAMPLE (big-triangle 100 "red") (triangle 100 "solid" "red")) (EXAMPLE (big-triangle 100 "orange") (triangle 100 "solid" "orange"))
-
; : ->(EXAMPLE (purple-square 15) (rectangle 15 15 "outline" "purple")) (EXAMPLE (purple-square 6) (rectangle 6 6 "outline" "purple"))
-
; : ->(EXAMPLE (banner "Game Today!") (text "Game Today!" 50 "red")) (EXAMPLE (banner "Go Team!") (text "Go Team!" 50 "red")) (EXAMPLE (banner "Exit") (text "Exit" 50 "red"))
-
; : ->(EXAMPLE (twinkle 5 "outline") (star 5 "outline" "yellow")) (EXAMPLE (twinkle 15 "solid") (star 15 "solid" "yellow")) (EXAMPLE (twinkle 36 "outline") (star 36 "outline" "yellow")
-
; : ->(EXAMPLE (half 2) (/ 2 2)) (EXAMPLE (half 4) (/ 4 2)) (EXAMPLE (half 9) (/ 9 2))
-
; : ->(EXAMPLE (how-long? "Soccer") 6) (EXAMPLE (how-long? "Cupcakes") 8) (EXAMPLE (how-long? "Hi Mom") 6) (EXAMPLE (how-long? "Cheese pizza") 12)
These materials were developed partly through support of the National Science Foundation,
(awards 1042210, 1535276, 1648684, and 1738598).
Bootstrap:Algebra by Emmanuel Schanzer, Jen Poole, Ed Campos Jr, Flannery Denny, and Dorai Sitaram
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.