Referenced from lesson Defining Table Functions
For the word problems below, assume animalA
and animalB
are defined as the data rows for Felix and Midnight, respectively.
Directions: Define a function called lookup-fixed
, which looks up whether or not an animal is fixed.
Contract and Purpose Statement |
Every contract has three parts…
# lookup-fixed::(r :: Row)->Boolean
# Consumes an animal, and looks up the value in the fixed column.
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 lookup-fixed(r):
__r["fixed"]
end
Directions: Define a function called lookup-sex
, which consumes a Row of the animals table and looks up the sex of that animal.
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: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.