CSC151.02 2016S, Class 27: Preconditions, Revisited
===================================================

_Overview_

* Preliminaries.
    * Admin.
    * Upcoming Work.
    * Extra Credit.
    * Questions.
* Recursion lab
* Preconditions lab

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

### Admin

* Continue partners.
* We'll do the recursion lab for the first half of class and the
  preconditions lab for the second half of class.

### Reminders

* Office hours this week 
    * See http://rebelsky.youcanbook.me.
    * I should be gone next Monday and Tuesday :-(
* Tutor hours
    * Sunday, 3-5 p.m.
    * Sunday-Thursday, 7-10 p.m.
* Weekly review sessions:
    * Wednesday at 8pm in the CS Commons with Evan.
    * Thursday review session this week with Sam.
    * Thursday at 8pm in the CS Commons with Alex.

### Upcoming Work:

* Reading for Friday?
* Exam 2 due NEXT TUESDAY.
* Quiz Friday: Recursion basics.
    * You should be able to read and write procedures like those from
      the recursion basics lab.
* Lab Writeup/Recursion Lab: Exercise _____
    * Send email titled __CSC 151 Lab Writeup 26 (Your Names)__
    * Do not include the underscores.
    * Send to <CSC151-02-grader@grinnell.edu>
    * Due before class on Monday.
* Lab Writeup/Preconditions Lab: Exercise _____
    * Send email titled __CSC 151 Lab Writeup 27 (Your Names)__
    * Do not include the underscores.
    * Send to <CSC151-02-grader@grinnell.edu>
    * Due before class on Monday.

### Extra Credit

* Send your reports to <rebelsky@grinnell.edu> with subject 
  "CSC 151 Extra Credit".  (Do not include the quotation marks.)
* Send opportunities to me before class with subject
  "CSC 151 EXTRA CREDIT OPPORTUNITY!"

#### Academic / Artistic

* Friday at 4:00 pm. in Burling: Decolonizing Digital Humanities

#### Peer

* The Tempest.  This weekend.  7:30 Friday and Saturday, 2:00 Sunday.
  Tickets in Bucksbaum box office.
* Salseros Friday at 8:30 pm in Garnder.  Food!  The JS non-brothers,
  sighing deeply.
* 8:00-10:00 show with various cool jazz-funk-pop at PC.  No free food.
* Sunday, 6:00-8:00 AAA Potluck in JRC 209.  Free ingredients!


#### Regular Peer

* Social Dance Workshop Tuesdays 7:00-8:00 in Bucksbaum Dance Studio
* Pun club Saturdays at 4pm in Younker 
* Electronic Potpourri on KDIC Fridays at Five 
* Space Odyssey KDIC Fridays at Six
* Bollywood, Friday, 7:30-8:30, Younker

#### Misc

#### Far in the Future

* Lords of the Flies, April.

### No Extra Credit, But Still Good

* Indoor track nationals.

### Questions

Recursion Lab
-------------

    (define list-length
      (lambda (lst)
        (if (null? lst)
            0
            (+ 1 (list-length (cdr lst))))))

    (list-length '(1 2 3))
    ; Is it null? No
    => (+ 1 (list-length (cdr '(1 2 3))))
    => (+ 1 (list-length '(2 3)))
    ; list-length is innermost operation.  
    ; is '(2 3) null?  NO!  So we replace the inner list-length
    ; with the alternate
    => (+ 1 (+ 1 (list-length (cdr '(2 3)))))
    => (+ 1 (+ 1 (list-length '(3))))
    ; list-length is innermost operation.  
    ; is '(3) null?  NO!  So we replace the inner list-length
    => (+ 1 (+ 1 (+ 1 (list-length (cdr '(3))))))
    => (+ 1 (+ 1 (+ 1 (list-length '()))))
    ; list-length is innermost operation.  
    ; is '() null?  YES!  Replace with 0
    => (+ 1 (+ 1 (+ 1 0)))
    => (+ 1 (+ 1 1))
    => (+ 1 2)
    => 3

Can we think about the base case for product?

    > (*)
    1

Okay, why? Because 1 is the multiplicative identify.    That means,

    > (product '())
    1

What's the writeup?

Writeup 26: 6ad, Recursion Basics Lab

Preconditions Lab
-----------------

Writeup 27: 3h, Verifying Preconditions Lab
