---
title: Eboard 28  Higher-order procedures, revisited
number: 28
section: eboards
held: 2018-04-09
link: true
---
CSC 151.01, Class 28:  Higher-order procedures, revisited
=========================================================

_Overview_

* Preliminaries
    * Notes and news
    * Upcoming work
    * Extra credit
    * Questions
* Trees lab, continued
* Quick debrief
* Vectors lab
* Debrief (?)

Preliminaries
-------------

### News / Etc.

* Continue partners!
* Quiz 9 returned.  We'll talk about it quickly.
* I finally got my grading software re-written.  Expect email grades
  later today.  Feel free to send corrections.
    * The math could be wrong.
    * I could be missing grades (e.g. extra credit)

### Upcoming work

* [Exam 3](../exams/exam03) 
    * Exam due **TOMORROW** via email
    * Epilogue due Wednesday via email
    * Cover sheet due in class Wednesday
* [Lab writeup for class 27/Trees](../writeups/writeup27): Exercise 8.
  Due before class Wednesday.
* [Lab writeup for class 28/HOP](../writeups/writeup28): Exercise 5.
  Due before class Wednesday.
* Reading for Wednesday
    * [Files in Scheme](../readings/files)
* [Flash Cards](../flashcards/flashcards10) due Wednesday at 5pm.
    * Optional.
    * Percent of *eight* flashcard assignments you complete (capped at 100).

### Extra credit (Academic/Artistic)

* Mando Memorial Lecture, Tuesday at 4:15 p.m. in JRC 101

### Extra credit (Peer)

* Drag show April 14

### Extra credit (Recurring peer)

* Listen to KDIC Wednesdays at 6pm - Witty banter with other 
  personalities and/or co-host.  Also Indian, Arabic, and Farsi music.  
  (Up to two units of extra credit.)
* Peer editing with SS.  Talk to SS about the details.  Make your
  English Lit more literate.

### Extra credit (Misc)

* Host one or more prospective students.  (I think there's one visit
  weekend left.)

### Other good things

* Leah Lakshmi Piepzna-Samarashina talk tonight at 7:30 p.m. in Harris.
* Tom Jorling presentation 7:30 p.m. tonight in Noyce 2022
* Movie: _Making a Killing: Guns, Greed and the NRA_, Tuesday, 7pm

### Questions

_Should we do more than just run your test suite in the examples section?_

> I'd prefer that you either (a) add a test case or two or (b) run an
  extra example or two by hand.

> You do, however, have to show the result of running `run-tests`.

_Can we convert lists to vectors in exam 3?_

> No. 

Continue trees lab
------------------

Writeup: Exercise 8, `number-tree-sum`.

Start hop lab
-------------

_How does `apply` differ from `map`?_

* `map` applies a procedure to each element of a list, creating a list
  of new values.
* `apply` applies the procedure to all the elements _en masse_, creating
  on value of whatever type the procedure returns.

_How does `apply` differ from `reduce`?_

* `reduce` reduces a list to a single value by repeatedly applying it 
  to neighboring pairs.
  `(reduce + '(1 2 3 4))` is approximately `(+ (+ (+ 1 2) 3) 4)`
* `apply` does everything _en masse_`.
  `(apply + '(1 2 3 4))` is `(+ 1 2 3 4)`
* `reduce` needs to have a binary procedure that returns 
  the same type that it takes as input.
* In contrast, `apply` can return different types (and even take different
  types of inputs).
    * We can't write `(reduce < '(1 2 3 4))`.  (Why not?)
    * We *can* write `(apply < '(1 2 3 4))`.  That computes
      `(< 1 2 3 4)`.
* We can use `apply` in a variety of other situations, such as with
  ternary procedures.
    * We can't write `(reduce substring '("grinnell" 0 4))`.
    * We *can* write `(apply substring '("grinnell" 0 4))`.

_What's the writeup for class 28?_

* Exercise 5.  Solve with recursion.

Debrief on trees lab
--------------------

_Next class._

Writing `number-tree-largest`.

Debrief on hop lab
------------------

_Next class._

Direct recursion is your friend!
