This workbook page references the Row Functions Starter File. Open that file on your computer, save a copy, and Click "Run"!
1 Find the definition for cat-row
. What do you get back when you evaluate cat-row
in the Interactions Area?
2 How many weeks did it take for cat-row
to be adopted? How many for young-row
?
3 Scroll down in the starter file until you find the Contract, Purpose, Examples and Definition for weeks-dot
. Discuss with your partner:
-
What is the Domain of this function? The Range?
-
The Purpose Statement is a way of describing the function in detail. Does the Purpose Statement make it clear what this function should do, when given a Row?
-
How many examples do you see defined for this function?
4 Look at the first two examples. How are they connected to the Contract and Purpose Statement?
These examples show us exactly what should be produced for cat-row
and young-row
- the two Rows representing "Miaulis" and "Nori", based on their weeks
to adoption. But these examples only tell us part of the story! Where does the computer get the number of weeks
from?
5 Now look at the last two examples. How are they connected to the first two?
6 Now look at the definition. How is this connected to our examples?
7 We’ve learned that representations of functions have to match. Look at the Examples carefully - there’s a mistake, where the Examples and Definition don’t match the Contract and Purpose. What’s the mistake?
When you’re done, fix the mistake in the code!
These materials were developed partly through support of the National Science Foundation,
(awards 1042210, 1535276, 1648684, and 1738598).
Bootstrap 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.