CSC 151 2019S, Class 13: Local bindings
Overview
- Preliminaries
- Notes and news
- Upcoming work
- Extra credit
- Friday PSA
- Questions
- Quiz
- Lab
- Debrief (maybe)
Preliminaries
News / Etc.
- Mentor sessions Wednesday 8-9 p.m., Thursday 8-9 p.m., Sunday 5-6 p.m.
- Warning! It’s Friday the 13th (class). Bad luck is possible.
- Note: It is a useful habit to reflect back after each exercise and ask
yourself “What did the exercise designer want me to take from this
exercise?”
- Since it seemed unclear to some of you: Your are not finished when
you do the lab writeup. You should look at (and, if possible, do)
all of the exercises in each lab.
- With four students gone, we may need to reshuffle a bit after the
quiz.
- I think I’ve now set things up so that the formatted eboard auto-updates
every five minutes during class.
Upcoming work
- There is no reading for Monday!
- Assignment 5 due next Tuesday.
- Your homework partner is your partner from Wednesday’s class
- Flash cards due Wednesday at 8:00 p.m.
- Covers Wednesday/Friday/Monday classes
- Quiz next Friday: Randomness and Local Bindings
- Iowa Flautists in Concert. Saturday, 23 February 2019.
3:45 p.m. Sebring-Lewis Hall.
- Last Chance Swim and Dive, Saturday at about 10:30 ec.
- Men’s BBall, Friday, 3:00 p.m. vs. LFC at St. Norbert. (Hopefuly a
Saturday game, too.)
- Indoor Track and Field, Friday and Saturday, at Monmouth.
- 30 Minutes of Mindfulness at SHACS 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.
Other good things
Friday PSA
Be happy. Be good. Be well. Be true to yourself.
Consent is essential.
Questions
Quiz
If you find that you finish early, take some time to meditate quietly.
Alternately, you may go get a drink of water or use the rest room.
Lab
Remember to review the self-checks! (More generally, remember to
do the self-checks!)
Debrief
I can fantasize that we’ll have time to debrief, can’t I?
What is the “moral” of the define
-vs-let
exercise?
Using define
within another definition does not always behave as
we expect.
More broadly, the semantics of define
are a bit more complex than
the semantics of let
.
Therefore, we recommend that you do not use define
within another
define
. (Use let
or let*
instead.)
However, we must admit that the designers of Racket prefer nested
define
expressions to let
.
What were the “morals” of exercise 5?
If you are defining values that are independent of the parameters
to a procedure, the (let ... (lambda ...))
form is more efficient.
Sam lied! Although Sam claimed that the definitions disappear when
the let finishes, in point of fact, they remain available in the
body of procedure, just nowhere else!
How can we simulate that stupid nested let
with a map
?
How Sam and others might do 2b
(map (o (section * 7 <>) (section expt 2 <>))
(range 5))
(map (lambda (x) (* 7 (expt 2 x)))
(range 5))
Can we explore the define
thing a bit more?
; This doesn't work
(define sample-w/define
(lambda (x)
(define x (+ x 1))
(list x x x)))
; What do you expect for this?
(define sample-w/define
(lambda (x)
(define y (+ x 1))
(list y y y)))