EBoard 14: Lists

Warning! You are being recorded (and transcribed) (provided the technology is working correctly).

Approximate overview

  • Administrative stuff [10 min]
  • Questions [10 min]
  • Lab [55 min or less]
  • Turn in lab [5 min]

Administrative stuff

  • Yay! I have both hearing aids. My hearing has now returned to mediocre instead of awful.
  • Prof. Perlmutter and I are still discussing what to do about the SoLA 1 issues. Stay tuned. I’ve released the graded SoLAs for the time being so that you can see how you’ve done. However, if the “dorm lounge” policy goes into effect, those will change.
    • Since the parties have not come forward, I’ll just remind them that the “I won’t report you to the committee on academic standing” policy doesn’t hold when I identify you.
  • MP4 should be released tomorrow night.
  • Reminders:
    • If I don’t respond on Teams within 12 hours (weekdays), feel free to DM me again.
    • If I don’t respond to email within 24 hours (weekdays), feel free to email me again.
  • Otter is fun!

Token activities

Academic/Scholarly

  • Thursday, 2024-02-22, 11:00-noon, JRC 101. Scholars’ Convocation: Luis Fabiano De Assis on Human Trafficking.
  • Thursday, 2024-02-22, 4:00pm, Science 2022. CS Extra: Declaring a CS Major.
  • Thursday, 2024-02-22, 7:00pm, Science 3819. Mentor Session. (lists, map, apply, and things similarly fun)
  • Tuesday, 2024-04-27, 7:00pm, Science 3819. Mentor Session.

Cultural

  • Friday, 2024-02-23, 4:00–5:00pm, HSSC N1170 (Global Living Room). Middle of Everywhere.
  • Friday, 2024-02-23, 7:00–9:00pm, Sebring-Lewis. Squatters on Red Earth.

Peer

  • Saturday night Casino night in Harris

Wellness

  • Tuesday, 2024-02-27, noon-1pm, BRAC P103. HIIT and Strength Fitness Class.
  • Tuesday, 2024-02-27, 12:15–12:50, Bucksbaum 131. Yoga in the Museum.
  • Tuesday, 2024-02-27, 4pm, BRAC P103 (Multipurpose Dance Studio): Yoga.

Misc

Other good things (no tokens)

Upcoming work

Questions

Administrative

Will Sam update tokens so that we can enter more?

Sure. It’s on my agenda for tonight. (Really this time.)

MP2

Can you give us a diagram for outlined right triangles?

Sure. I’ll add it to my agenda for tonight. (Really this time.)

MP3

Lists

When do we use apply?

When we have a procedure that expects a bunch of parameters and we’ve somehow managed to put all of those parameters into a list.

Most frequently, when we have a procedure that expects “as many parameters as you give it” and a list. We might apply +, string-append, beside, above.

In the next reading, you’ll learn a similar procedure, reduce, that works with pairs of elements.

Random

Why are pears so important?

They are an awesome fruit.

Why are pairs so important?

We use them to build lists. They were part of LiSP, the ancestor of Racket. They’ve been shown to be powerful. We’ll explore them in a few weeks.

Lab

Observations

There are three versions of range.

  • One parameter: (range n) -> '(0 1 2 ... n-1)
  • Two parameters: (range m n) -> '(m m+1 m+2 ... n-1)
  • Three parameters: (range m n i) -> '(m m+i m+2i ...)

Why so many experiments with range?

  • To remind you that when you’re exploring a new procedure, you should try lots of different kinds of inputs.
  • To suggest the different kinds of inputs you might give to range.

Help

Procedures that work with strings and make lists

  • (string->lst str)
  • (string-split str)

The test procedures return nothing if the test succeeds and issue an error message if they fail.

(define char->digit
  (lambda (char)
    5))

(test-equal? "five" (char->digit 5) 5)
(test-equal? "six" (char->digit 6) 6)
--------------------
six
. FAILURE
name:       check-equal?
location:   3-unsaved-editor:10:0
actual:     5
expected:   6
--------------------

What’s the “three-parameter map”?

You’ve seen it already: (map - (range 3) (list 2 1 2))

It builds a new list by applying the procedure to the corresponding elements of the two lists.