The table t
below represents four animals from the shelter:
name | sex | age | fixed | pounds |
---|---|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fun is-fixed(r): r["fixed"] end
fun is-young(r): r["age"] < 4 end
fun nametag(r): text(r["name"], 20, "red") end
Match each table description on the left, to the Circle of Evaluation that will produce it.
A table containing only Toggle and Sasha |
1 |
A |
(sort t "age" true)
|
|
Produces a table of only young, fixed animals |
2 |
B |
(filter t is-fixed)
|
|
Produces a table, sorted youngest-to-oldest |
3 |
C |
(build-column t "sticker" nametag)
|
|
Produces a table with an extra column, named "sticker" |
4 |
D |
(filter t is-young)
|
|
Produces a table containing Toggle and Sasha, in that order |
5 |
E |
(filter (filter t is-young) is-fixed)
|
|
Produces a table containing Toggle, Fritz, and Nori |
6 |
F |
(sort (filter t is-young) "pounds" false)
|
|
Won’t run: will produce an error (why?) |
7 |
G |
(sort (build-column t "label" nametag) "age" true)
|
|
Produces a table with an extra "label" column, sorted youngest-to-oldest |
8 |
H |
(sort t "cuteness" false)
|
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.