EBoard 25: Numeric recursion (Section 1)

Please follow the standard start-of-class routine.

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

Approximate overview

  • Administrivia
  • Q&A (potentially)
  • Pop quiz
  • Lab

Administrative stuff

Announcement about Computing Peers United (CPU) Buddies Program

  • A mentorship program that pairs less experienced students (“mentees”) with more experienced students (“mentors”).
  • As 151 students, you are considered less experienced.
  • Lots of advice: Conferences, hack-a-thons, courses, internships.
  • Get connected with the broader CS community.
  • Posters will be up soon with QR codes and URLs.
  • November 10 at 8pm opening event. More dead trees!

Introductory Notes

  • I had a non-productive weekend, so I’m a bit behind on grading. Stay tuned! I’ll also be spending the first few minutes of lab getting some important things updated.
    • Token events
    • Lab 2
  • Thank you to all the folks who asked and answered questions on MP4.
  • We had a problem in class on Friday: A student was observed taking pictures of a quiz on their phone. Hence, I am imposing stricter guidelines on phone usage during quizzes.
    • Your phone must be in your bag during quizzes.
    • Your phone must be turned off (or at least silenced)_ during quizzes.
    • If we see your phone out during a quiz,
      • I will void all of your LA grades. (You can still make them up in subsequent weeks.)
      • Your final grade in the class will be reduced by one letter grade.
      • I will report you for an academic honesty violation.

Upcoming work

Upcoming activities

Scholarly

  • Tuesday, 3 October 2026, Noon–1:00 p.m., CS Commons (I think). CS Table
  • Thursday, 5 October 2026, 11:00 a.m.–Noon, JRC 101. Scholars’ Convocation: More Humanities

Artistic/Cultural

  • Any day. Visit the GCMOA for at least 30 minutes.

Multicultural

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

Peer

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

Wellness

  • Monday, 2 November 2026, 8:00–9:00 p.m., Prayer Garage in the CRSSJ. Meditation Group
  • Tuesday, 3 November 2026, 12:15–12:45 p.m., GCMoA. Yoga in the Museum
  • Tuesday, 3 November 2026, 4:30–6:00 p.m., Bear P103. Wellness Yoga
  • Tuesday, 10 November 2026, 5:00–8:00 p.m., HSSC North Auditorium. Therapy Dogs

Misc

  • Wednesday, 4 November 2026, 8:00–9:00 p.m., Science 3820. Mentor Session
  • Thursday, 5 November 2026, 8:00–9:00 p.m., Science 3820. Mentor Session

Other good things

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

Check in on the “Sam talks less” experiment

  • Do you want me to go over the upcoming work?
    • Yes: 7
    • No: 8
    • Abstain: 1
  • Do you want me to go over the token events?
    • Yes: 6
    • No: 7
    • Abstain: 5
  • Do you want Q&A time?
    • Yes: 13
    • No: 1
    • Abstain: 5
  • Do you want me to go over problems from the previous lab that people struggled on?
    • Yes: 16
    • No: 1
    • Abstain: 3
  • Would you prefer that I send out notes about problems from the previous lab that people struggled on or talk about them in class or both?
    • Email: 6
    • In-class: 3
    • Both: 8
    • I don’t care: 2
  • Do you want me to record class?
    • Yes: 8
    • No: 0
    • Abstain: 12
  • Do you want to discuss any of the issues above?

Q&A

MP4

Could you explain more about similar colors?

Bad decision on Sam’s part?

Bad writing on Sam’s part?

Go through the list. For each color, remove any remaining elements that are similar to it.

Administrative

Pop quiz

  • What is your favorite kind of (soda) pop?
  • Strings: What are the two forms of substring and what do they do?
  • Colors: How do you extract the blue component from an RGB color?
  • Anonymous functions: Rewrite (l-s - 3) with lambda.
  • Drawings: List three functions that make shapes.

Lab

  • There are two labs today. You’ll start the second one after you finish the first (assuming you finish the first).
  • You will continue partners on Wednesday.
  • First lab: tail-recursion.scm.
    • Exercise 1 on today’s first lab should be “Tallying strings”
    • Refresh if it’s not
    • Rename the previous tail-recursion.scm lab to recursion-patterns.scm

Exercise 1: Tallying strings

;; tally-so-far remaining ;; ———— ——— ;; 0 (list 5 “a” “b” 1 “c” 2 3 “b” 4) ;; 0 (list “a” “b” 1 “c” 2 3 “b” 4) ;; 1 (list “b” 1 “c” 2 3 “b” 4) ;; 2 (list 1 “c” 2 3 “b” 4) ;; 2 (list “c” 2 3 “b” 4) ;; 3 (list 2 3 “b” 4) ;; 3 (list 3 “b” 4) ;; 3 (list “b” 4) ;; 4 (list 4) ;; 4 null


* When should we stop? When we have a null list.
* What should we return when we are done? `tally-so-far`
* How do we "simplify" `remaining`? `(cdr remaining)`
* What should the recursive call look like?
    * What should we do to `tally-so-far`? If the car of remaining
      is a string, add 1 to `tally-so-far`. If not, add 0.
    * We already know that we take `(cdr remaining)`
    * `(tally-strings/helper ??? (cdr remaining))`

(define tally-strings/helper (lambda (tally-so-far remaining) (if (null? remaining) tally-so-far (tally-strings/helper (+ (if (string? (car remaining)) 1 0) tally-so-far) (cdr remaining)))))

0))

(define tally-strings (lambda (lst) (tally-strings/helper 0 lst))) ```

  • Second lab: numeric-recursion.scm

Notes during lab