The table t below represents four animals from the shelter:

name sex age fixed species pounds

"Toggle"

"female"

12

true

"dog"

48

"Fritz"

"male"

4

false

"dog"

92

"Nori"

"female"

6

true

"dog"

35.3

"Sunflower"

"female"

2

false

"cat"

11.6

Define the functions specified below by filling in the blanks. The first one has been done for you.

1

is-cat: is the animal is a cat?

fun is-cat(r): r["species"] == "cat" end

2

is-dog: is the animal is a dog?

fun is-dog(r): end

3

is-big: does the animal weigh more than 50 lbs?

fun is-big(r): end

Convert each Circle of Evaluation below into Pyret code. What do you think the resulting table will be? The first one has been done for you.

Circle of Evaluation Produces…​

4

(sort (filter t is-dog) "name" false)

A table of only dogs, sorted alphabetically in descending order: Toggle, Nori, Fritz sort​(​filter​(​t, is-dog​), "name", false​)

5

(sort t "name" false)

6

(build-column (filter t is-cat) "large" is-big)

7

(filter (sort t "pounds" true) is-dog)

8

(filter (build-column t "large" is-big) is-cat)

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.