CSC 151.01, Class 26: Vectors
Overview
- Preliminaries
- Notes and news
- Upcoming work
- Extra credit
- Questions
- About the exam
- Lab
- Debrief
Preliminaries
News / Etc.
- New partners!
- Review sessions Thursday at 7pm and 9pm.
- Lab writeup from Monday: Note that you should have one pair-o-boxes
per call to cons.
- Please check in with Monday’s partner if you got things marked off.
Upcoming work
- Exam 3 distributed.
- Prologue due Friday via email
- Exam due Tuesday via email
- Epilogue due Wednesday via email
- Cover sheet due in class
- Lab writeup for class 26: Exercise 4 Due before class Friday.
- Reading for Friday
- Flash Cards due today at 5pm.
- Quiz Friday: Local recursive bindings with letrec and named let;
randomness; pairs and pair structures.
- Likely one named let question and one “draw this structure” question.
Extra credit (Academic/Artistic)
- Cello concert tonight.
- Danforth lecture on Thursday at 11 am in JRC 101. Robert G. Bergman. “Irreproducibility in the Scientific Literature or: How Often do Scientists Tell the Truth, the Whole Truth and Nothing but the Truth?”
- Roxane Gay talk Friday noon in Harris Cinema.
- Tabla concert Friday night
- Visit the two exhibits at the Faulconer Gallery. (Are there still two exhibits in the Faulconer gallery?)
Extra credit (Peer)
- Men’s Tennis, April 14, 21, and 22.
- Drag
Extra credit (Recurring peer)
- Listen to KDIC Wednesdays at 6pm - Witty banter with other
personalities and/or co-host. Also Indian, Arabic, and Farsi music.
(Up to two units of extra credit.) - Peer editing with SS. Talk to SS about the details. Make your English Lit more literate.
Extra credit (Misc)
- Donate on Scarlet and Give Back day tomorrow.
- Grinnell is a wonderful place; please consider donating.
- If your funds are too limited to allow a donation, I’ve provided an alternative.
- Host one or more prospective students.
- Discussion on the diversity and inclusion plan tonight at 6pm (I think)
Other good things
- Grinnell Singers in Concert on Sunday at 2pm in Sebring Lewis.
- Passover Seder on Friday, send email to Rabbi Rob to sign up.
Questions
What are the “errors” and “times” things on the grading sheet.
- Everyone gets one point for each error someone finds in the main body of the exam (up to five points), starting 5pm today.
- I ask you to record your times. If you do so, you get 2 points.
What happens if we choose the “wrong” kind of recursion.
- I’ll generally be sympathetic, unless you do something irritatingly
inefficient, like calling
lengthagain and again and again.
Should we document our named let helpers?
- Yes. A line or so is fine.
- “Find an approximation of the square root of n, given that the root is between lower and upper.”
Can we stop doing flash cards after today
- I suppose. I will grade you on the number of flash cards you turn in divided by 9, with a cap of “100 percent”.
About the exam
Recursion in CSC 151. Wicked neat!
Lab
Can we really use /home/rebelsky/Desktop/pg1260.txt as our source for
words?
Sure. It’s Jane Eyre, book 1260 of Project Gutenberg.
What’s the writeup?
Exercise 4,
vector-sum.
Debrief
How are vectors implemented so that they provide such fast access?
- That’s a good question.
- Vectors, like pairs, group references, rather than values.
- Every reference is the same size.
- So, to find element
iof a vector, we look at the positionvector-start + i*reference-size
Could you explain “gc time”?
- That’s also a good question.
- We often build lists (or parts of lists) and then stop referencing them.
- If we keep doing that, we’ll exhaust all possible memory (whiteboard) locations.
- At that point, we’ll need to use the unneeded memory for other purposes.
- “Garbage collection” is DrRacket’s attempt to find the created but unneeded parts of memory and make them available.
For start of next class …
I hear that there are two approaches you saw to vector-sum. What were they?
- Stay tuned!
Why am I getting weird errors when I try to use the result of vector-set!?
- Because
vector-set!returns nothing. You’re probably trying to use the result in some future computation. - You’ll see a slightly different pattern of recursion for procedures
in which you modify vectors.
- Call
vector-set!to modify - and Recurse
- Call
- We now have multiple consequents after a guard. We should therefore
use
whenorcond, depending on the situation.