Referenced from lesson Defining Functions
There is space below to define four different functions, writing their Contracts, two examples, and the definition itself. The function gt
- which makes solid green triangles of a given size - is provided as an example. Can you define bc
as a function which makes solid blue circles of a given radius?
Directions: gt
Contract and Purpose Statement |
Every contract has three parts…
# gt::Number->Image
# _______
Examples |
Write some examples, then circle and label what changes…
examples:
__gt (10)is triangle(10, "solid", "green")
__gt (20)is triangle(20, "solid", "green")
end
Definition |
Write the definition, giving variable names to all your input values…
fun gt(size):
__triangle(size, "solid", "green")
end
Directions: gold-star
Contract and Purpose Statement |
Every contract has three parts…
# _________::______->_____
# _______
Examples |
Write some examples, then circle and label what changes…
examples:
___________ (__)is _________________________
___________ (__)is _________________________
end
Definition |
Write the definition, giving variable names to all your input values…
fun _________(______):
_______________________________
end
Directions: MMMMMMMMMM
Contract and Purpose Statement |
Every contract has three parts…
# __________::_->_
# _______
Examples |
Write some examples, then circle and label what changes…
examples:
____________ (_____________) _________is ________________________________________
____________ (_____________) _________is ________________________________________
end
Definition |
Write the definition, giving variable names to all your input values…
fun __________(_):
___
end
Directions: MMMMMMMMMM
Contract and Purpose Statement |
Every contract has three parts…
# __________::_->_
# _______
Examples |
Write some examples, then circle and label what changes…
examples:
____________ (_____________) _________is ________________________________________
____________ (_____________) _________is ________________________________________
end
Definition |
Write the definition, giving variable names to all your input values…
fun __________(_):
___
end
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.