EBoard 08: Numbers (Section 3)

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

We are back to the standard start-of-class procedure.

Approximate optimistic overview

  • Administrative stuff [10 min]
  • About Wednesday’s quiz [10 min]
  • Questions [5 min]
  • Lab [50 min]
  • Turn in lab [5 min]

Administrative stuff

Introductory notes

  • Don’t forget that you can raise your hands during lab and either the mentor or I will wander over and try to help.
  • Please do not use your electronic devices for anything other than classwork or a quick check of your email/texts. Anything else may lead to us defenestrating your device.
  • My weekend fell apart a bit, so I’m a bit behind on everything. In particular, I haven’t looked at your pre-reflections or reading responses. Apologies!
  • I’m running out of my time allocation on Otter.ai, so I won’t be using it to record sections 2 or 3.

Upcoming activities

Scholarly

  • Thursday, 13 February 2025, 11:00 a.m.–Noon, JRC 101. Grinnell Lecture: Darrius Hills on “The Achievement of Identity: Soul Work, Salvation, and Black Manhood in the Religious Imagination of James Baldwin”.
  • Tuesday, 18 February 2025, Noon–12:50 p.m., PDR 224C (White Dining Room). CS Table: ???

Artistic

  • Tuesday, 11 February 2025, 4:00–5:00 p.m., Bucksbaum 131 (GCMoA). Gallery Talk with Chen, Kluber, and Tavares.
  • Friday, 14 February 2025, 5:00–6:30 p.m. (talk at 6:00), 926 Broad St (Stewart Arts Building). Opening Reception for Artist Salon: Works by Grinnell College Art Majors

Multicultural

  • Friday, 14 February 2025, 4:00–5:00 p.m., HSSC N1170 (Global Living Room) Middle of Everywhere: Japan / Bento Boxes
  • Saturday, 15 February 2025, ?:00-?:00 p.m., Harris Gym. Lunar New Year

Peer

Musical, theatric, sporting, and academic events involving this section’s students are welcome.

Wellness

  • Tuesday, 11 February 2025, 12:15–12:50 p.m., GCMoA. Yoga in the Museum.
  • Tuesday, 11 February 2025, 4:30–6:30 p.m., BRAC P103 (Multipurpose Dance Studio). Wellness Yoga.

Misc

Other good things

These do not earn tokens, but are worth your consideration.

  • Friday, 14 February 2025, 4:00–?. Field (of Dreams) House. Darren Young Classic.
  • Saturday, 15 February 2025, 10:00–?. Field House. Darren Young Classic, Continued.

Upcoming work

About Wednesday’s Quiz

I will ask you to trace an expression that includes function calls. I expect you to trace one step at a time. Here’s an example.

Consider the following definitions.

(define x 10)
(define y 11)
(define f (lambda (x y) (* (+ x 2) (+ y 3))))

Trace the steps in evaluating (f (+ x y) (- x y)). We’ll do this together. One person does the next step, the next person says whether or not it looks good to them. And again, and again, and again.

    (f (+ x y) (- x y)))
--> (f (+ 10 y) (- 10 y))
--> (f (+ 10 11) (- 10 11))
--> (f 21 (- 10 11))
--> (f 21 -1)
--> (* (+ 21 2) (+ -1 3))
--> (* 23 2)
--> 46
  • Note: When substituting in for variables, do only one variable at a time.
  • Note: When replacing a function call by the body of the function, do ALL the substitutions at once.
  • Note: We traditionally evaluate the subexpressions left to right.
  • Please do only one subexpression at a time; historical evidence suggests that students (and Sams) make mistakes when we try to do more than one thing at once.
  • Note: If you have a call to a built-in-function with more than two parameters, you can do the work all at once. (+ 1 2 3) -> 6. (string-append "hello" " " "bye") -> "hello bye".
  • (map sqr (list 1 2 3 4)) -> (list (sqr 1) (sqr 2) (sqr 3) (sqr 4)). [Don’t worry; we won’t have map.]

Q&A

Administrative

How many tokens does it cost to make up a missed mini-project?

The token policy page says that it costs one. Note, however, that the “first redo” will be your only opportunity to earn an E, even though it’s effectively your first submission.

Readings

MP3

In documenting procedures that work with colors, should I use something specific, like rgb?, or should I use color?.

You should use whichever is correct. If your procedure only works with RGB colors, you should use rgb?. If it works with any color, use color?.

Lab

  • Don’t forget to make a copy of the code!
  • Save!
  • If you finish early, please do the extras.
  • If you all make good progress on this lab, Sam will have some questions.

round

The round procedure rounds a number to the nearest whole number.

  • (round 5/2) -> 2
  • (round 7/2) -> 4

When there are two equally near whole numbers, it rounds toward the even number.

Note: Some of the weird behavior we see is intentionally thought out. (Not all of it, but some of it.)

max

If all of the inputs to max are exact, the result will be exact.

If any of the inputs to max are inexact, the result will be inexact.

Why? Because we lack complete info on inexact numbers, so assuming that our exact number is precise would be wrong.

(max (+ 4 (expt 2 100)) (+ 7 (expt 2.0 100)))

(max (+ 4 (expt 2 100)) (+ 1 (expt 2.0 100)))

Once we’ve started estimating in one place, we have to estimate everywhere.

More fun

(+)

(*)

(max)

Numerator and denominator of inexact numbers

  • (numerator 1.2) ->
  • (denominator 1.2) ->