UNB/ CS/ David Bremner/ teaching/ cs2613/ labs/ Lab 3

Before the lab

Background


Questions from last time

Time
10 Minutes
Activity
Group discussion

In this part of the lab, we will discuss some questions from the On your own part of L02.

Git

Setup

The DrRacket stepper

Time
20 min
Activity
Individual work

Unit testing is an important part of programming, and has inspired something called test driven development.

This part is based on an example from RackUnit QuickStart. - copy arith.rkt, save it as ~/cs2613/labs/L03/arith.rkt and commit it.

Semantics

Time
20 min
Activity
Small Groups
Summary
new evaluation rules for and and or

As you read in FICS unit 3, we can understand evaluation ("running") of Racket programs as a sequence of "reductions" or "substitutions". These rules are similar to the reduction steps in the DrRacket stepper.

The stepper uses the following rules for and and or (notice that these rules enforce short circuit evaluation)

(and true exp2 ...) => (and exp2 ...)
(and false exp2 ...) => false
(or true exp2 ...) => true
(or false exp2 ...) => (or exp2 ...)
(and) => true
(or) => false

Following Exercise 7, write a new set of rules that requires at least two arguments for and and or. The rules are for human consumption; you can write them as comments in DrRacket. You can write "exp1 exp2 ..." to mean at least 2 expressions.

Discuss your answers with a your group, and try a couple evaluation small examples by hand using your rules.


Test Coverage

Time
25 min
Activity
Individual work

If you have extra time


Reading for next lab

On your own

Time
20 min
Activity
Independent research

See if you can come up with answers to the following questions for next time.