CSC151.01 2014F, Class 28: Other Forms of List Recursion
========================================================

* New partners (for real today!)
* Chocolate!

_Overview_

* Preliminaries.
    * Admin.
    * Upcoming Work.
    * Extra Credit.
    * Questions.
* Questions and answers.
* Some notes on yesterday's lab.
* Some key ideas from the reading.
* Lab.

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

### Admin

* Office hours today and next week
    * Mostly Normal (Th 1:45-3:15; walking 1:15-1:45); No hours on Friday
    * Mornings I will be in various places.  If you want to find me, email me.
* Review sessions tonight at 8pm, Thursday at 10 am, Thursday at 8pm.

### Upcoming Work

* Writeup: Problem 3 (due Friday): <http://bit.ly/151-2014F-w28>
* [Exam 2](../assignments/exam.02.html) due NOW!
    * Epilogue due tonight
* Reading for Friday:
    * [Numeric Recursion](../readings/numeric-recursion-reading.html)
* Friday's quiz: Identify your classmates.  (I provide first names and
  a set of pictures.)  No notes permitted.  Ten minutes.

### Cool Events

* Concert tonight!

### Extra Credit Opportunities

#### Academic

* CS Table, Friday: Hear about the Grace Hopper Celebration of Women
  in Computing.

#### Peer Support

* Football (Saturday at 1pm)
* Swimming October 18: Alumni Weekend
* Karan's radio show 11pm Thursday nights on KDIC
* Evan's radio show 5pm Friday nights on KDIC
* Donna's radio show Sunday midnight on KDIC
* Men's Tennis (???)
* Women's Tennis (???)

### A Quick Note/Demo on Indentation

* For the students who bring me code for exam questions, one of the first
  things I do is reindent the code.  Why?  Because indentation often tells
  you when you have mismatched parentheses.
* Let's look at an example.

### Comments on Academic Honesty

* Small things can still be academically dishonest
* For fairness: Individual faculty should not make the decision
* And it's almost break, so think good thoughts!

### Questions (Administrative)

Questions and answers
---------------------

Lab
---

_What's the base case for `largest`?_

> It's easy to find the largest value in a single-element list.  It's
  hard to find the largest value in a zero-element list.

_I heard the mentors say "Oh, that's a different `largest` than I expected".
 What are the different ways that people write `largest`?_

        (define largest-a
          (lambda (lst)
            (if (null? (cdr lst))
                (car lst)
                (max (car lst) (largest (cdr lst))))))

        (define largest-b
          (lambda (lst)
            (largest-b-helper (car lst) (cdr lst))))

        (define largest-b-helper
          (lambda (largest-so-far remaining)
            (if (null? remaining)
                largest-so-far
                (largest-b-helper (max largest-so-far (car remaining))
                                  (cdr remaining)))))

_I want to locally bind a non-recursive procedure called `irgb-darker`
 so that I can apply the pattern from problem 3._

> Certainly

        (define irgb-darkest
          (let ([irgb-darker (lambda (color1 color2)
                               (if (> (irgb-brightness color1)
                                      (irgb-brightness color2))
                                   color1
                                   color2))])
            (lambda (colors)
              ...)))

