(define <name> <expression>).(lambda (<parameters>) <expression>).(define <name> (lambda (<parameters>) <expression>))As in 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 focus on the immediate task of designing and coding a solution, speaking aloud about their design thoughts as they work.
- The other person, the navigator, acts as a reviewer. They observe and think more about strategic architectural issues. They look for potential issues and raise them with the driver. They are also responsible for keeping track of the time spent on the problem.
All of the instructions are in the two files! Switch over to those now.
If you find that you complete the laboratory with time to spare, you might consider doing one or more of the following exercises.
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.
As you may recall, we used the following code to count the number of words in a string.
;;; Procedure:
;;; count-words
;;; Parameters:
;;; str, a string
;;; Purpose:
;;; Determine how many words appear in string.
;;; Produces:
;;; count, a non-egative integer.
;;; Preconditions:
;;; [No additional]
;;; Postconditions:
;;; count represents the number of words in the string.
;;; Note that a "word" is any sequence of characters separated
;;; by a space.
(define count-words
(lambda (str)
(length (string-split str " "))))
count-words works.count-words on a few inputs.Using a lambda, write a procedure, (count-letter str letter), that counts how many times the letter appears in str.
For example:
> (count-letter "The vorpal sword went snicker snack" "o")
2
> (count-letter "The vorpal sword went snicker snack" "s")
3
> (count-letter "The vorpal sword went snicker snack" "z")
0
(Hint: Think about the definition of count-words.)
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.