EBoard 31: Higher-order programming (Section 3)

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

Approximate optimistic overview

  • Administrative stuff
  • Discussion of reading
  • Q&A
  • Lab

Administrative stuff

Introductory notes

  • Apologies
  • Please make more use of the evening tutors!

Upcoming activities

Scholarly

  • Tuesday, 22 April 2025, noon–1pm, White PDR. CS Table: ???

Artistic

  • Saturday, 19 April 2025, Noon–4:00 p.m., Central Campus. SpringFest
  • Saturday, 19 April 2025, 7:30–9:30 p.m., Harris Concert Hall. Titular Head
  • Monday, 21 April 2025, 4:00–5:00 p.m., GCMoA. Poetry Reading by Lívia Stein Freitas

Multicultural

  • Friday, 18 April 2025, 4:00–5:00 p.m., HSSC N1170 (Global Living Room). Middle of Everywhere: Northern & Southern China on a Plate (Breakfast)
  • Friday, 18 April 2025, 6:00 p.m.–Midnight, Harris Gym. SOL Quinceañera
    • Tickets are required for the food.
  • Saturday, 19 April 2025, 1:00–4:00 p.m., HSSC A1231 (Multi-purpose Kernel). Japanese Spring Festival
  • Saturday, 26 April 2025, 1:00–8:30 p.m., Cleveland Beach. Holi

Peer

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

  • Read articles by your fellow CSC-151 students and comment on them online.

Wellness

  • Friday, 18 April 2025, 6:00–8:00 p.m., Aux Gym. Badminton Club (Smash that bird!)
  • Friday, 18 April 2025, 6:30–8:00 p.m. Dance Studio. Brazilian Jiu-Jitsu
  • Friday, 18 April 2025, 9:00 p.m., Noyce Elbow. Nerf at Noyce.
  • Saturday, 19 April 2025, 4:00–6:00 p.m., Aux Gym. Badminton Club (Smash that bird!)
  • Monday, 21 April 2025, 6:30–8:00 p.m. Dance Studio. Brazilian Jiu-Jitsu
  • Tuesday, 22 April 2025, 12:00–12:45 p.m., Dance Studio. HIIT Training.
  • Tuesday, 22 April 2025, 12:15–12:50 p.m., GCMoA. Yoga in the Museum.
  • Tuesday, 22 April 2025, 4:30–6:30 p.m., BRAC P103 (Multipurpose Dance Studio). Wellness Yoga.
  • Wednesday, 16 April 2025, 6:30–8:00 p.m., Dance Studio. Brazilian Jiu-Jitsu
  • Thursday, 17 April 2025, 12:00–12:45 p.m., Dance Studio. HIIT Training.
  • Thursday, 17 April 2025. 4:30–6:30 p.m., Off Campus. Forest Bathing.
    • Sign ups are required.
  • Tuesday, 29 April 2025, 5:00–6:00 p.m., HSSC Atrium. Therapy Dogs.
  • Tuesday, 29 April 2025, 7:15–8:15 p.m., HSSC Atrium. Therapy Dogs.

Misc

  • Sunday, 20 April 2025, 7:30–8:30 p.m., Science 3819. Mentor Session: SoLA 3
  • Tuesday, 22 April 2025, 7:00–8:00 p.m., Science 3820. Mentor Session: Prep for quizzes
  • Wednesday, 23 April 2025, Noon–1:00 p.m., HSSC A2231 (Auditorium) Community Forum
    • “Weekly discussion on legal protections and recourse on issues that higher education and Grinnell College face.”
    • Also online.
    • This week: ???

Other good things

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

  • Saturday, 19 April 2025, 9:00 a.m.–Noon, Tennis Courts. Men’s Tennis vs. Ripon
  • Saturday, 19 April 2025, 3:00–6:00 p.m., Tennis Courts. Men’s Tennis vs. Lawrence

Upcoming work

  • Friday, 18 April 2025
  • Sunday, 20 April 2025
  • Monday, 21 April 2025
    • SoLA 3 distributed
      • Topics from phase one: Decomposition, Primitive types, Collaboration, Lambda-free anonymous procedures (aka cut and compose).
      • Topics from phase two: Conditionals, Documentation, Testing, Lists (and “the big three”), Program Style, Ethical Considerations
      • Topics from phrase three you’ve done quizzes on: List recursion, local bindings.
      • New topics from phase three: Numeric recursion, vectors, randomness.
  • Wednesday, 23 April 2025
    • Quiz: Data abstraction / structs
    • Makeup quiz: Dictionaries
    • Makeup quiz: Diagramming structures (paper only)
    • Don’t forget that you can bring a page of hand-written notes for each quiz.
  • Thursday, 24 April 2025
    • SoLA 3 due
      • Topics from phase one: Decomposition, Primitive types, Collaboration, Lambda-free anonymous procedures (aka cut and compose).
      • Topics from phase two: Conditionals, Documentation, Testing, Lists (and “the big three”), Program Style, Ethical Considerations.
      • Topics from phrase three you’ve done quizzes on: List recursion, local bindings.
      • New topics from phase three: Numeric recursion, Vectors, Randomness
  • Sunday, 27 April 2025
    • Submit first redo for MP7 on Gradescope
  • Friday, 16 May 2025
    • Submit final redo for MP1 on Gradescope
    • Submit final redo for MP2 on Gradescope
    • Submit final redo for MP3 on Gradescope
    • Submit final redo for MP4 on Gradescope
    • Submit final redo for MP5 on Gradescope

Friday PSA

  • You are wonderful people.
  • Others care about you.
  • Please take care of yourselves.
  • “It’s Friday, I’m in love.”
    • Consent is essential, but not sufficient.

Readings

TPS

What are the big ideas? (There are at least three.)

  • You can write procedures that create new procedures. (This can be powerful, but also dangerous.)
  • We can write the big three procedures! (map, filter, reduce)
    • You have gained in knowledge. Yay!
  • You can write procedures that take other procedures as parameters. (In fact, that’s true of map, filter, and reduce.)
  • The ability to take and return procedures suggest that Racket is a “higher order” programming language.

How would you write filter? (Recursively)

(define filter
  (lambda (pred? lst)
    (if (null? lst)
        lst ; or null
        (if (pred? (car lst))
            (cons (car lst) (filter pred? (cdr lst)))
            (filter pred? (cdr lst))))))

Suppose we had the list '(1 2 3 4 5) and we wanted to filter the odd numbers.

     (filter odd? '(1 2 3 4 5))
     ; Not empty, pred holds
---> (cons 1 (filter odd? '(2 3 4 5)))
     ; Not empty, pred fails
---> (cons 1 (filter odd? '(3 4 5)))
     ; Not empty, pred holds
---> (cons 1 (cons 3 (filter odd? '(4 5))))
     ; Not empty, pred fails
---> (cons 1 (cons 3 (filter odd? '(5))))
     ; Not empty, pred holds
---> (cons 1 (cons 3 (cons 5 (filter odd? '()))))
     ; Empty
---> (cons 1 (cons 3 (cons 5 '())))
---> (cons 1 (cons 3 '(5)))
---> (cons 1 '(3 5))
---> '(1 3 5)

Questions

Questions

Administrative

Will dictionaries be on SoLA 3?

No.

Readings

Can we go over the self check?

Sure.

Lab

right-section

(right-section binproc val) is supposed to take a two-parameter procedure and a value, use the value as the second (right) parameter of binproc, and return a new procedure that expects the first first parameter.

Very similar to (cut (binproc <> val)).

For example,

  • (right-section + 3) -> (lambda (x) (+ x 3))
  • (right-section - 4) -> (lambda (x) (- x 4))
  • (right-section make-list "Scar") -> (lambda (n) (make-list n "Scar"))

No type checking is necessary.