Skip to main content

CSC 151.03, 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.
  • I should have a draft code of conduct for Friday’s class.
  • Mentor sessions tonight at 8 and tomorrow at 7 and 8.

Upcoming Work

Extra credit (Academic)

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

Extra credit (Peer)

None at the moment.

Extra Credit (Misc)

None at the moment.

Other Good Things

  • Men’s Soccer vs. Buena Vista, Sept. 17 at 2:00 p.m.
  • Women in Computing, TONIGHT at 7:00 p.m. in the CS commons.

Questions

What is a helper procedure?
Any extra procedure you write to help you write the primary procedure more clearly, efficiently, easily, …

Lab

I’m worried about that entry that does not have numbers.
You should be worried.
We’ll deal with the issue in problems 3 and 4; it won’t matter for 1 and 2.
Any overall hints?
Focus on individual entries first. Then think about how to generalize for the list.
“I want to compare two entries” not “I want to compare any two entries in the list.”
“I want to transform one entry” not “I want to transform every entry in the list.”
Any hints on problem 2?
Remember that you should figure out how to transform one element first.
I would build three lists and append them together in the right order.
  • The first three elements (use take)
  • The next two elements (use take and drop)
  • The last element (use drop)
You could also grab each element using list-ref and then shove them back together using list.
How many a’s and d’s can I have in things like cadddr?
Four
What if I want caddddr?
There are lots of options.
(define caddddr (section list-ref <> 4))
(define caddddr (o car cddddr))
(define caddddr (o car cdr cdr cdr cdr))
Oh, I could just use list-ref, couldn’t I?
Yes.

Debrief

Next class.