CSC151.01 2015S, Class 39: Randomized (Unpredictable) Drawing
=============================================================

* Continue Partners!

_Overview_

* Preliminaries.
    * Admin.
    * Upcoming Work.
    * Extra Credit.
    * Questions.
* Quiz. 
* Lab.

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

### Admin

* Given where I found Corn Nuts, I may never bring food again.
* How many people have at least two other major things (exams, papers) due
  next week (in addition to the 151 exam)?
* Review session Monday at 7pm.
* It's nearly prereg time.  Think about taking 161 in the fall!
* A friendly reminder: If you miss class, you do have an obligation to
  send me a note.

### Upcoming Work

* Lab writeup: Exercise 4c
  <http://bit.ly/151-2015S-lab39>
* Readings for Monday: 
    [Elements and Principles of Two-Dimensional Design](../readings/design-elements-reading.html) and
    [About the Project](../assignments/project.html)

### Extra Credit Opportunities

#### Academic 

* CS Table Friday: Design for User Empowerment
  <http://interactions.acm.org/archive/view/march-april-2015/design-for-user-empowerment>
* CS Extras next Thursday: Nora Bressette Buccino on her summer REU
  (Android and Robots!)
* CS Table next Friday: TBD.

#### Peer Support (Morning Section)

* Track and Field at Drake on Friday and Saturday.  Watch the Javelin
  throw Friday at 3:45 and see Grinnell's own MWC Most Valuable Player
  of the Week.  Sorry, no live targets.
* KY's radio show, "We Think We're Funny", 9-10pm Mondays.
  "It's all about Ultimate Flying Disc"
* Julia's radio show, "The Hot Box".  Wednesday night/Thursday morning 
  1:00-2:00 a.m.  
* How an admitted student this coming Sunday night (or the following
  Sunday night)!  Contact JMU for info.
* ISO Show, Saturday night 7-9 pm at Harris.  Many live performances.
* More things to be announced next week!

#### Miscellaneous

* Town hall April 23, noon or 7:30 pm, "How we have conversations."

### Other Good Things (no extra credit)

_Doug Dale's show in Smith_

### Questions

* None.

Quiz
----

* If you finish before your partner, get DrRacket started and review
  the reading.

Lab/Debrief
-----------

The ideal outcome of a strong liberal arts education is the ability
to bullsh*t coherently and compellingly about any topic.

Rawhide!

Multiple strategies

* Use a `let` to name the roll

    (define tally-seven-eleven
      (lambda (n)
         (cond [(<= n 0) 
                0]
               [(let ([roll (pair-a-dice)])
                  (or (= roll 7) (= roll 11)))
                (+ 1 (tally-seven-eleven (- n 1)))]
               [else 
                (tally-seven-eleven (- n 1))])))

* Use a `let` to name a procedure that checks whether a roll is 7 or eleven

    (define tally-seven-eleven
      (let ([seven-or-eleven? 
              (lambda (val) (or (= val 7) (= val 11)))])
        (lambda (n)
           (cond [(<= n 0) 
                  0]
                 [(seven-or-eleven? (pair-a-dice))
                  (+ 1 (tally-seven-eleven (- n 1)))]
                 [else 
                  (tally-seven-eleven (- n 1))]))))

* Use `member?`

    (define tally-seven-eleven
      (lambda (n)
         (cond [(<= n 0) 
                0]
               [(member? (pair-a-dice) (list 7 11))
                (+ 1 (tally-seven-eleven (- n 1)))]
               [else 
                (tally-seven-eleven (- n 1))])))

