EBoard 03: Writing Functions (Section 3)

Warning! You are being recorded (and transcribed) (provided the technology is working correctly).

The start-of-class algorithm

  • Grab: Whiteboard, pen, eraser
  • Do the blue card algorithm.

The blue card algorithm

  • Grab one of the small cards by the jar.
    • Determine which computer you’ll be at and where it is.
    • Put the card in the jar.
    • Navigate to the computer.
  • If you’re the first to arrive, log in.
  • When both of you arrive, say hello and chat.

Approximate overview

  • Administration
  • Q&A from readings
  • Lab

Administrative stuff

Introductory Notes

  • Don’t forget that reading responses are due the night before class!
  • A reminder: If you have questions that might be of general interest, please ask them on the Teams Q&A channel.
    • _Sam demos.
  • As many of you discovered, Scamper has a different password than your other Grinnell accounts. Please use the one I sent you via email. If you’d like to change your password, let me know and I can do so.
  • As long as we’re discussing passwords: I strongly suggest that you register on https://passwordreset.grinnell.edu.
    • Sam demos
  • We’ve added mentor sessions at 8pm on Wednesday and Thursday nights. Check in this room for where they are.
  • We’re short a bunch of international students today. We wish them luck on their travels to Des Moines. They should collaborate (in pairs or triplets) on the lab, preferably in this room from 7–10 p.m. tonight.

Upcoming activities

Scholarly

  • Thursday, 3 September 2026, 11:00 a.m.–noon, JRC 101. Scholars’ Convocation: Anne Harris
    • Insert Sam’s Convo schpiel

Artistic/Cultural

Multicultural

  • Friday, 4 September 2026, 4:10–5:00 p.m., HSSC N1170. Middle of Everywhere (Algeria)

Peer

Musical, theatric, sporting, academic, and similar events involving this section’s students are welcome.

  • Saturday, 5 September 2026, 1:00 p.m.–4:00 p.m., Rosenbloom Field Men’s American Football vs. Mount Mercy

Wellness

  • Wednesday, 2 September 2026, 4:00–5:00 p.m., Burling 1st. Speed Friending
  • Monday, 7 September 2026, 8:00–9:00 p.m., Prayer Garage. Meditation Group
  • Tuesday, 8 September 2026, 4:30–6:00 p.m., Bear P103. Wellness Yoga

Misc

  • Wednesday, 2 September 2026, 8:00 p.m.–9:00 p.m., Noyce 3rd. Mentor Session
  • Thursday, 3 September 2026, 8:00 p.m.–9:00 p.m., Noyce 3rd. Mentor Session

Other good things

These do not earn tokens, but are worth your consideration.

  • Friday, 4 September 2026, 7:00–9:00 p.m., Darby. Volleyball vs St. Benedict (UPDATED)
  • Saturday, 5 September 2026, 11:00 a.m.–1:00 p.m., Darby. Volleyball vs. St. Catherine
  • Saturday, 5 September 2026, 1:00–3:00 p.m., Springer Field. Men’s Unamerican Football vs. Hamline
  • Saturday, 5 September 2026, 3:00–5:00 p.m., Darby. Volleyball vs. Simpson College
  • Sunday, 6 September 2026, 11:00 a.m.–1:00 p.m., Spring Field. Women’s Unamerican Football vs. St. Mary’s

Upcoming work

About the quizzes/LAs

  • Short questions on the topics.
    • Decomposition: “Here’s a compound image; rewrite it to describe component parts and avoid repetition.”
    • Functions: Here’s some code we might want to parameterized. Do so.
  • You can (should) bring a “cheat sheet”: Handwritten notes for the quiz.
  • Code need not be perfect, but should be close.
  • Running from 3:30–4:00 p.m. on Friday.
  • If you are permitted (or just want) extra time, I’ll stay here until 4:30.
    • You can also take one during our normal time and take the other at 11:00 a.m. or 7:30 a.m.
  • Treat the first quiz as a learning experience; it will give you a sense as to what quizzes are like. Since we use mastery grading, there’s no real penalty if you have difficulty.

Administrative Q&A

When I use the #lang racket and (require csc151), I get weird error messages.

I’m sorry. Those were the commnds from DrRacket. Now we just use (import image).

Why didn’t I get anything when I typed the following in the definitions pane and clicked “Run”? (Note that I also didn’t get anything when I typed it in the REPL.)

(import image)
(define circles
  (above (beside (outlined-circle 100 "red")
                 (solid-circle 150 "blue"))
         (beside (outlined-circle 150 "blue")
                 (solid-circle 100 "red"))))

A define statement associates a value with an identifer, but doesn’t show it. To show the value, you have to type the identifier. E.g.,

circles

(beside circles circles)

Is there a way to get the code to indent nicely?

Yes. Hit Ctrl-I. We’ll use the code below as an example.

(import image)
(define squares
(above (beside (outlined-square 100 "red" 10)
(solid-square 150 "blue"))
(beside (outlined-square 150 "blue")
(solid-square 100 "red" 10))))

When you overlay and align, can you be more precise (e.g., using coordinates)?

Yes, but I’m not sure how well those work right now.

Use overlay/offset.

Why couldn’t I type lambda on my laptop?

Computers are evil. I’ll look at it during lab.

Q&A from Readings

What is the instructions for making a simple smiley face?

You’ll get to try in lab.

How should I have written the procedures?

The standard form of a procedure is something like

(define NAME
  (lambda (INPUTS)
    EXPRESSION))

For sub2, the NAME is sup2, the INPUTS are just val (or whatever you want to call the input), and the expression to subtract 2 is `(- val 2).

Putting it all together, we get

(define sub2
  (lambda (val)
    (- val 2)))

For the secondone, the NAME is block, the INPUTS are just color, and the expression to build the rectangle is (solid-rectangle 40 20 color).

Putting it all together, we get

(define block
  (lambda (color)
    (solid-rectangle 40 20 color)))

Lab

Don’t forget that there’s a fancy house in the reading.

Don’t forget that there’s a (rotate angle-in-degrees image) function.

If you finish early, do some of the extra problems.

It’s also okay if you don’t finish!

At the end, follow the “end of lab” algorithm.

  • Save the file to disk.
  • Upload it to Gradescope
  • Wait for the autograder. (Today’s just says it ran; future ones will say more.)
  • Email it to your partner.