Lab: Booleans values, predicates, and conditionals

Assigned
Thursday, 8 April 2021
Summary
In this lab, you will have the opportunity to explore the use of predicates as well as Scheme’s three primary conditional control operations, if, when, and cond.

Your team should decide who will take the A-side and B-sides of the lab. Each member should make a copy of the appropriate code:

And follow the instructions in your respective files! When you are done, combine the files, rename the result to conditionals.rkt, and upload the completed lab to Gradescope. Make sure to include your partner as a pair!

For those with extra time

Extra 1: Be more forgiving!

In one of the lab questions, you were asked to write a forgiving "Yes" prompt checker. If you have additional time, work with your partner on enhancing this checker so that it accepts other reasonable forms of “Yes”, including other words, e.g., “Yup”, abbreviations and short-hands such as “Y”, and strange capitalizations, such as “yeS”.

Extra 2: Cleaner computations

In our experience, most of you wrote gpa->letter with the “B” test looking like this.

    [(and (< g 3.5) (>= g 2.5))
     "B"]

However, it is possible to write that without the and (and even without the 3.5). If you wrote something long like that, rewrite your gap->letter to be more efficient.

If you are puzzled, ask one of the staff for help (@staff).

Extra 3: Moving on

If you still have extra time after that, start talking through project 2 to share idea on how you might get started. (Not yet posted!!)