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"

51.6

For each of the Circles of Evaluation below, convert them into Pyret code. What do you think the resulting table will be? The first one has been done for you.

Circle of Evaluation Pyret code

1

(sort (build-column t "kg" kilograms) "name" true)

sort​(​build-column​(​t, "kg", kilograms​), "name", true​)

2

(sort (filter t is-fixed) "name" true)

3

(build-column (filter t is-female) "kg" kilograms)

4

(filter (sort t "name" true) is-female)

5

(filter (filter t is-female) is-fixed)

Define the functions specified below by filling in the blanks.

6

A function is-fixed, which returns true if the animals is fixed.

fun is-fixed(r): end

7

A function kilograms, which returns the weight of the animal in kilograms (1kg is about 2.2lbs).

fun kilograms(r): end

8

A function is-female, which returns true if an animals weighs more than 50 pounds.

fun is-female(r): end

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.