Skip to main content

CSC 151.01, Class 09: Tables and compound data

Overview

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

News / Etc.

  • I will distribute answer keys for homework 3 on Thursday night. (Some of you asked for extensions until then.)
  • I do not yet have my grading system up and running. When I do, I will distribute grades. Until then, I cannot.
  • There’s a lot in today’s lab, so I’ll try not to do too many preliminaries.
    • Well, we will discuss the exam.
  • I should have a draft code of conduct for Friday’s class.

Upcoming Work

Extra credit (Academic)

  • CS Extras, Thursday at 4:15 p.m. in 3821: Caldron: A UI for CRNs.

Extra credit (Peer)

  • Elelphantitis, Saturday, Grinnell Middle School
  • Men’s Soccer vs. Buena Vista, Sept. 17 at 2:00 p.m.

Extra Credit (Misc)

None at the moment.

Other Good Things

  • Women in Computing, TONIGHT at 7:00 p.m. in the CS commons.

Questions

There were none.

Lab

Wow, that’s a lot of data
Just wait until Friday’s class!
Please explain “There are 42,767 lines in?”
Whoops. Fixing that now.
Should our code be readable?
When possible.
The (lambda (params) should be on a line by themselves
I want to experiment with a single city. How should I do that?
(define single-city (car one-two-three))
Do you have hints on rearranging an entry?
Make a list of the city and state elements using take and drop
Make a list of the first three elements using take
Make a list of the last element (county) using drop
Append them together
How do I get caddddr
Lots of ways
(define caddddr (section list-ref <> 4))
(define caddddr (o car cddddr))
(define caddddr (o car cdr cdr cdr cdr))
Remember! Work on individual entries first and then map onto the list
(or sort or …)
Ok.

Debrief

Sam will do the debrief at the beginning of next class.

Writeup

  • Exercise 4

Thinking

  • Look back to examples from the reading and try to understand what they were doing.
  • Don’t let the big list distract you. For many things, you’ll focus on one value (or two) and then use map or sort or reduce to work with the larger list.

Formatting

(define zf->cf (lambda (entry) (append (take (drop entry 3) 3) (take entry 2) (drop entry 5))))

vs.

(define zf->cf
  (lambda (entry)
    (append (take (drop entry 3) 2)
            (take entry 3)
            (drop entry 5))))

Documentation

  • Please use three semicolons, not one.
  • Please put a space after the three semicolons.