---
title: Eboard 33  Association lists
number: 33
section: eboards
held: 2017-11-15
---
CSC 151.03, Class 33:  Association lists
========================================

_Overview_

* Preliminaries
    * Notes and news
    * Upcoming work
    * Extra credit
    * Questions
    * Mentor evaluations
* Lab
* Debrief

### News / Etc.

### Upcoming Work

* No reading for Friday.  Work on your projects.
* [Writeup for class 32](../writeups/writeup32) due TODAY at 10:30 p.m.
    * Exercise 6
    * To: <csc151-01-grader@grinnell.edu>
    * Subject: CSC 151.01 Writeup 32 (YOUR NAMES)
* [Writeup for class 33](../writeups/writeup33) due Friday at 10:30 p.m.
    * Exercises 4b and 4c.  No documentation is required.
    * To: <csc151-01-grader@grinnell.edu>
    * Subject: CSC 151.01 Writeup 33 (YOUR NAMES)
* Exam 3 cover pages due NOW!
    * Did you put your number on the sheet?
    * Did you sign both statements (if you feel comfortable doing so)?
    * Did you date both statements?
    * Did you remove the ra-cha-fringies if you removed the paper
      from a notebook?
* Exam 3 Epilogues due TONIGHT!
    * One of the best comments so far: "This would have been much
      easier if I did the self-check problems every day."
* Quiz Friday!
    * Association lists, algorithm efficiency, maybe trees
    * Mentor sessions tonight at 8pm, tomrrow at 7pm and 8pm.

### Extra credit (Academic/Artistic)

* Pub-free quiz at Bob's.  TONIGHT 9pm (I think).  Stats-Math focus.
* Convocation Thursday at 11 a.m. in JRC 101.  "Work's Provocative Future: 
  Which Graduates Will Thrive?"
* Social Media in the U.S. and China, Thursday, Nov. 16, 7-9pm 
  JRC 2nd.  Chinese snacks provided.

### Extra credit (Peer)

* "The First Time I Walked on the Moon".  Four, count 'em, four performances.
  Thursday at 7:30, Friday at 7:30, Saturday at 7:30, Sunday at 2:00.
    * "You've got to pay attention to what's going on."
* Orchestra, Saturday at 2pm

### Extra credit (Misc)

### Other good things

* Fresh Flutes Thursday
* Voice recitals Friday at 4:15 (Henderson) and 7:00 (Manuel)
* Women's Basketball vs. Emmaus TONIGHT at 5:00 p.m.
* Men's Basketball vs. Emmaus TONIGHT at 7:00 p.m.
* Swimming and Diving Saturday at 1:00 p.m.

### Questions

When should I turn a list into a vector?
  : If, for example, you don't expect to change the length and you are
    doing a lot of calls to list-ref.

What did that mean?
  : I have a list, like '("Scooby Doo" "Shaggy" "Velma" "Fred" "Daphne" "Scrappy Doo" "The Van")
  : If it seems like I'm doing things like `(list-ref best-show-ever 4)`
    I'm probably better off turning it into a vector.  `vector-ref` is
    much faster than `list-ref`.
  : If it seems like characters are being added, `(cons "Another Zombie" best-show-every)``, I don't want a vector.

Best show ever, really?
  : No.

How does the vector procedure turn its elements into a vector?
  : Magic.

Explain: "Some of you may recall that we said that "`if` can take a value other than #t or #f.  Here's an example why."
  : The nearby code looks something like the following.

```
(let ([result (assoc "Scooby" tv-shows)])
  (if result
      (cadr result)
      #f))
```

When would you want to turn a vector into a list?
  : Most frequently, when you want to use one of the handy-dandy list procedures we have already, like `filter`.

Can I redefine a variable within a procedure?
  : Yes, but that practice is usually discouraged because it may confuse the reader
  
```
(define my-proc
  (lambda (val)
    (let ([+ -])
      (+ val 2))))
```

Mentor and tutor evaluations
----------------------------

* Goal: Improve our program

Lab
---

Writeup is 4b and 4c.

Can we make up the cartoon characters and sidekicks?
  : Sure.
  : `("Zandy Proton" "Sky Rebel")`
  : `("UM, the Ulimate Mentor" "UH, the Ultimate Helper")`

What should `multi-assoc` return in the base case?
  : "`multi-assoc` returns a list of matching entries"
  : So it should return a list.
  : What list is appropriate?

Do you have hints for writing `multi-assoc`?
  : Don't call `assoc`.
  : Look at the pattern we have for recursing over a list.  (Or how
    `assoc` is defined.)

Debrief
-------
