1 On the three lines below, write the code to lookup the value of the age column from dog-row, old-row, and young-row.

2 On the three lines below, write the code that uses the circle function to draw a solid, blue circle whose radius is the age of the animal. You can find the Contract for circle on the Contracts Page. If you’re working with a printed workbook, the contracts pages are included in the back.

3 When you are confident with the code you have written, check with your partner or another student. Do you have the same code? Why or why not?

Instead of writing this out over and over for each animal, let’s define a function to do it for us!

Defining the Function

Define a function called age-dot, which takes in a row from the Animals Table and draws a solid, blue circle whose radius is the age of the animal. HINT: Use of the rows from above in your examples!

Contract and Purpose Statement

Every contract has three parts…​

age-dot::Row->Image

_

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 age-dot(_):

_________________________________

end

These materials were developed partly through support of the National Science Foundation, (awards 1042210, 1535276, 1648684, 1738598, 2031479, and 1501927). CCbadge 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.