Lab: Writing your own procedures

Assigned
Tuesday, 6 April 2021
Summary
We explore techniques for writing proceres in Racket.

Syntax to remember

  • Defining names: (define <name> <expression>).
  • Function expressions: (lambda (<arguments>) <expression>).

The lab

Like the previous lab, you will be working with a randomly assigned partner with two complementary files:

One person should download the a file and the other person should download the b file. You can both follow the directions in your respective files which will direct you both when to take driver and navigator roles. Note that in addition to the programming components of this lab, there are also discussion questions where you will write your conclusion/results in the provided comment.

Remember to employ good pair programming practices as discussed in the previous lab!

  • One person, the driver, will share their screen via MS Teams and is in control of keyboard. They will type in the code that the pair collaboratively designs and focuses on making sure the code is syntactically correct.
  • The other person, the navigator, steers the design of the program. They take charge of solving the problem as well as acting as a second pair of eyes on the code. They are also responsible for keeping track of the time spent on the problem.

Additional practice

If you find that you complete the laboratory with time to spare, you might consider doing one or more of the following exercises.

Snowmen, revisited

As you may have noted, your colorful-snowman procedure from the lab creates an invisible snowman if the color is white. Write a new procedure, (better-snowman height color) that draws a snowman in the given color with every circle outlined in black.

Smiley face

There is an additional problem in the code file which asks you to draw a smiley face.

Acknowledgements

The checkerboard example comes from a very old version of CSC 151. I’m not sure which member of the department wrote it.

Bits and parts of this lab come from procedure labs from other versions of CSC 151.