You have the following functions defined below (read them carefully!):
fun is-fixed(r): r["fixed"] end
fun is-young(r): r["age"] < 4 end
fun nametag(r): text(r["name"], 20, "red") end
The table t
below represents four animals from the shelter:
name | sex | age | fixed | pounds |
---|---|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Match each Pyret expression (left) to the description of what it does (right).
|
1 |
A |
Produces a table containing only Toggle and Maple |
|
|
2 |
B |
Produces a table of only young, fixed animals |
|
|
3 |
C |
Produces a table, sorted youngest-to-oldest |
|
|
4 |
D |
Produces a table with an extra column, named "sticker" |
|
|
5 |
E |
Produces a table containing Maple and Toggle, in that order |
|
|
6 |
F |
Produces a table containing the same four animals |
|
|
7 |
G |
Won’t run: will produce an error |
|
|
8 |
H |
Produces a table with an extra "label" column, sorted youngest-to-oldest |
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.