1 Write the code to lookup the value of the age
column for each of the rows listed (the first one has been completed for you).
row | code to lookup the value of the age column |
---|---|
|
|
|
|
|
2 Write the code that uses the circle
function to draw a solid, blue circle whose radius is the age of the animal for each of the rows listed (the first one has been completed for you).
row | code to draw a circle using the "age" of the row as the radius |
---|---|
|
|
|
|
|
3 Check with your partner or another student to confirm that your code matches.
Instead of writing repetitive code like this 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 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). 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.