---
title: Eboard 16  Displaying data
number: 16
section: eboards
held: 2018-02-26
link: true
---
CSC 151.01, Class 16:  Displaying data
======================================

_Overview_

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

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

### News / Etc.

* New partners!
* I feel like a broken record, but your exams are not graded.
    * My conference days generally started at 7:00 a.m. and ended after
      10:00 p.m.  (I was told that my responsibilities permitted some
      significant breaks; that was a lie.)
    * I left about one week behind on work.  I returned about three weeks
      behind.
    * Grading your exams is one of my top priorities.
* There have been some common questions on the homework, so I'll spend a
  bit of the start of class working through those questions. 
    * I apologize to those of you who finished already.

### Upcoming work

* [Lab writeup for class 16](../writeups/writeup16): Exercise 3.
  Due before class Wednesday.
* Reading for Wednesday: 
    * [Verifying preconditions](../readings/predoncitions)
* [Homework 5](../assignments/assignment05) due Tuesday
* Exam 2 to be distributed on Wednesday morning
    * Exam 1 will be returned Wednesday evening (I hope)

### Extra credit (Academic/Artistic)

* Visit the two exhibits at the Faulconer Gallery.

### Extra credit (Peer)

### 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)

* Fill out NCHA Survey (aka the latest food truck survey).
    * Students received e-mails from "Jen Jacobsen ncha-web@acha.org" with the subject line "NCHA survey:  Help GC help you + food trucks!"  (Depending on outlook settings, this may end up in other or clutter folders)
    * NCHA data help me give my PSAs

### Other good things

### Notes on Quiz 5

```
(define bar (list -6 -5 1 2 3 4))
(or (exact? 7.0) (car bar) (cadr bar))
```

Sort lists of the following form by city
```
'(("UIowa" "Iowa City" "IA" "52242")
  ("UChicago" "Chicago" "IL" "60637")
  ("GrinCo" "Grinnell" "IA" "50112"))
```

_Detour: Why is the following a bad way to represent the data?_

```
'(("UIowa" "Iowa City" "IA" 52242)
  ("UChicago" "Chicago" "IL" 60637)
  ("GrinCo" "Grinnell" "IA" 50112))
```

An answer: Numbers are not the best way to represent zip codes, since some
zip codes have leading zeroes (or zeros).

Let's write a procedure, `(sort-by-city colleges)`, that sorts a list
of that form.

```
(define sort-by-city-1
  (lambda (colleges)
    (sort colleges
          compare-by-city)))

(define compare-by-city
  (lambda (c1 c2)
    (string-ci<=? (cadr c1) (cadr c2))))

(define sort-by-city-2
  (lambda (colleges)
    (sort colleges
          (comparator string-ci<=? cadr))))

; comparator takes something that compares (like < or string-ci<=?) and
; what to compare.

(define sort-by-city-3
  (lambda (colleges)
    (sort colleges
          (lambda (c1 c2)
            (string-ci<=? (cadr c1) (cadr c2))))))

(define sort-by-city-4 (section sort <> (comparator string-ci<=? cadr)))

### Questions

_Can you explain the metasyntactic variables `foo` and `bar`?_

> Not today.

_Can you provide some suggestions on problem 1, particularly how we deal with
unknown lists of speakers?_

> Most of you wrote a procedure that figures out the information for one
  speaker.  `(analyze-speaker table speaker-name)`

> You could write (list (analyze-speaker table "Trump") (analyze-speaker
  table "Clinton") (analyze-speaker table "Stein") ...)

> You can map that procedure over the list of candidates
  `(map (section analyze-speaker table <>) (list "Trump" "Clinton" Stein"))`

> That assumes we know the list of candidates (speakers).

> How do we get the list of candidates if we don't know them in advance?
  
    1. Extract the list of candidates, with duplicates, by mapping car
    (or something equivalent) over the whole table.
    2. Use `tally-all` to make a list of `(candidate count)` pairs.
    3. Map `car` over that list.

_Can we treat moderators as candidates?_

> Yes.

Lab
---

Debrief
-------
