Skip to main content

CSC 151 2019S, Class 27: Pairs and pair structures

Overview

  • Preliminaries
    • Notes and news
    • Upcoming work
    • Extra credit
    • Questions
  • Representing lists with pairs (cons cells)
  • Why care about the underlying representation
  • Lab

Preliminaries

News / Etc.

  • Sit with your homework partner.
  • Mentor sessions Wednesday 8-9 p.m., Thursday 8-9 p.m., Sunday 5-6 p.m.
    • Sarah says: “Studies suggest that people who use mentor sessions score a full letter grade higher.”
    • Sam says; “Correlation is not causation, but …”
    • Times? Okay as is.
    • Note: If you have an individual tutor, you should think about attending at least one mentor session each week.
  • I continue to hear reports that some folks are dividing up assignments, rather than working together. Please work together!

Upcoming work

  • Homework 8 due Tuesday.
    • Partners assigned yesterday.
    • Homework to be made available this evening.
  • Friday’s quiz: Recursion, including local bindings and numeric recursion.
  • Reading for Friday: Vectors
  • Flash cards tonight: Recursion
  • Lab writeup: Exercise 1 and Exercise 3
    • Hand in your answers

Extra Credit

I would certainly appreciate suggestions of other extra credit activities (preferably via email).

Extra credit (Academic/Artistic)

Extra credit (Peer)

  • Track and Field at Mount Mercy this coming weekend.
  • Women’s Golf at Illinois Wesleyan this coming weekend.

Extra credit (Wellness)

  • Friday, April 12, 4-6pm: Make fidgets. Maker lab, 927 Broad street. For more information or accommodation, contact [bernalma] or [phamanht]
  • Monday, April 15, 7:30 p.m., Harris Cinema: From the Munchies to Memory Effects: What the Science Says About Cannabis/Marijuana

Extra credit (Wellness, Regular)

  • 30 Minutes of Mindfulness at SHACS (SHAW) every Monday 4:15-4:45
  • Any organized exercise. (See previous eboards for a list.)
  • 60 minutes of some solitary self-care activities that are unrelated to academics or work. Your email reflection must explain how the activity contributed to your wellness.
  • 60 minutes of some shared self-care activity with friends. Your email reflection must explain how the activity contributed to your wellness.

Extra credit (Misc)

  • Wednesday the 10 at 4pm in Darby Gym: Not-as-giant Laurel Leaf.
    (Free t-shirt!)
  • Scarlet and Give Back Day TODAY!
  • CANCELLED: “State of SHAW” talk Thursday at 11am in JRC 101.
  • Participate in Kinetic Sculpture Competition: Saturday the 27th
    • https://bit.ly/kineticsculpture19
    • You’ll need to build your sculpture in advance.
    • You get reimbursed for up to $200 in supplies, but must present to be reimbursed.

Other good things

Questions

Representing lists with pairs and cons cells

Why care about the underlying representation

It takes much longer to find elements later in the list, we prefer

 (define fun
   (lambda (lst)
     (if (null? lst)
          ...
         (... (car lst)
              (fun (cdr lst))))))

  (define fun
    (lambda (lst pos)
      (if (= pos (length lst))
          ...
          (... (list-lef lst pos)
               (fun lst (+ 1 pos))))))

Drawing the pictures can help us understand why things work the way they do.

No matter how you build a list, it is effectively built by cons.

Lab

  • Plan time to meet to work on homework.