Skip to main content

Class 22: Revisiting Lists

Held: Tuesday, 28 February 2017

We consider more general approaches to lists in Scheme

Preliminaries

Overview

  • Lists, revisited
  • car, cons, and cdr
  • Other new list operations
  • Representing drawings as values

Updates

News / Etc.

  • Continue partners!
  • While our lab grader seems to be on top of things, our homework grader seems to be having trouble keeping up. I’m looking to hire an additional homework grader. I apologize for the difficulties. I hope things will be resolved soon.
  • Strike policy reminder. I respect the student initiative on this issue. But you should have something to strike against. I will still teach class. I will not penalize you for missing class if you send me a one-paragraph reflection on some aspect of the strike.

Rotating reminders

  • Visit me in my office! I’m always happy to see students during my office hours. I prefer that you book me at https://rebelsky.youcanbook.me, but you can also just show up during office hours and hope that I’m not busy.
  • Note that my office hours have been filling as of late. Talk to me individually if you can’t find a booking time.

Upcoming Work

Extra credit (Academic/Artistic)

  • CS Table, Tuesday at noon: Facial Recognition “algorithms”
  • W. Kamau Bell, Tuesday at 6pm, Harris.
  • Prazak Quartet, Tuesday, 28 February 2017, 7:30 p.m., Herrick.
  • CS Extras, Thursday at 4:15 pm, Sam’s research and PM’s research

Extra credit (Peer)

Extra credit (Misc)

  • Non-violent protest training session TODAY at 4:00 in JRC 101.
  • Preventing sexual assault, Tuesday at 11am, JRC 101
  • Host a prospective student THIS COMING WEEKEND. (March 5, April 8, April 23)
  • Write the eboard equivalent for class Tuesday, Wednesday, or Friday next week.

Good things to do

  • Bagel party in Math commons, Thursday, 7-9 pm. Lox status unclear.

Lists

  • Our first encounters with lists.
    • Collection of values
    • Homogeneous: All the values in a list are the same type
    • Used primarily with map
  • Extending that notion
    • Can also be heterogeneous: Values in the list may have multiple types.
    • Can examine individual elements with car, cdr, and list-ref.
    • Can be extended (creating new lists) with cons.
    • There’s an empty list: null.
  • Why is the new view important?
    • It will soon give us the opportunity to manipulate lists in new and interesting ways.

Implementing Drawings

  • We can (and do) use lists to implement drawings.
  • The reading considers a simplified representation, in which the width and height of a drawing are the same.
  • But the general process is the same
    • Group the values in a list
    • When we need to render or manipulate a drawing, use the list operations to extract parts.

Lab