Respond to the questions below using Functions Starter File.

Maroon Square

1 We’re going to test out the function maroon-square. Let’s think about its domain and range.

  • What does maroon-square consume?

  • What does maroon-square produce?

2 What do you think the function maroon-square does?

3 Let’s test it out. Type maroon-square(20) in your Interactions Area, then hit enter. Repeat this for the other two examples that you see in the Definitions Area. What happens and why?

Sample

4 On lines 23-27, some different values have been defined. What are their names?

5 Let’s examine what happens when we use each of those values as inputs for sample. Hit "Run". Type small-yellow-tri into the Interactions Area and hit enter. Then, test out sample(small-yellow-tri). What do you Notice? What do you Wonder?

6 What do you expect to happen when you test big-blue-tri and sample(big-blue-tri)?

7 If you’d like, test out hello-text and sample(hello-text). You can run sample with any image-producing functions.

8 In your own words, describe how the function sample transform its input.

9 Did you notice how the code in the EXAMPLES section goes down and to the right, like a staircase? Why do you think the programmer wrote it that way?

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.