EBoard 26: Vectors, continued (Section 1)
Warning! You are being recorded and transcribed, provided the technology
is working correctly.
Approximate optimistic overview
- Administrative stuff
- Quick notes on pairs and pair structures
- Q&A
- Quick notes on vectors (maybe)
- Lab
Administrative stuff
Introductory notes
- Quizzes returned (I hope). One was unidentified.
- I sent out grade reports yesterday. Let me know if you have questions
or concerns.
- For those who need yet another redo for MP1, MP2, or MP3, I’ve set final
redos due at the end of the semester.
- I know that you have not yet received MP4 and MP5 redos back. Nonetheless,
I’ve set redos for Sunday, April 20.
- There are whiteboards and markers placed neatly next to your workstation.
Please replace them at the end of class.
Upcoming activities
Scholarly
- Thursday, 10 April 2025, 11am–noon, HSSC A1231.
Scholars’ Convocation: Jen Shook: Instead of RedFace: Relational Trails in “Indian Country,” Onstage, Online, and IRL
- Thursday, 10 April 2025, 4:00–5:30pm, the Kernel (HSSC Multipurpose Room).
CS Poster Session
- Tuesday, 15 April 2025, noon–1pm, Some PDR.
CS Table: ???
Artistic
Multicultural
- Friday, 11 April 2025, 4:00–5:00 p.m., HSSC N1170 (Global Living Room).
Middle of Everywhere:???
Artistic / Multicultural
- Thursday, 10 April 2025, 7:00–9:00 p.m., HSSC A2231.
Superfest Disability Film Festival: Opening
- Saturday, 12 April 2025, 10:30–11:30 a.m., Drake Library.
Superfest Disability Film Festival: Family-Friendly Shorts
- Saturday, 12 April 2025, 10:00 a.m.–noon, HSSC A2231.
Superfest Disability Film Festival: Feature Film
- Saturday, 12 April 2025, 1:30 p.m.–3:45 p.m., HSSC A2231.
Superfest Disability Film Festival: Chronic Pain Shorts
- Sunday, 12 April 2025, 10:00 a.m.–noon, HSSC A2231.
Superfest Disability Film Festival: Feature Film
- Sunday, 12 April 2025, 1:30 p.m.–3:45 p.m., HSSC A2231.
Superfest Disability Film Festival: Assorted Shorts and Panel
Peer
Musical, theatric, sporting, and academic events involving this section’s
students are welcome.
- Read articles by your fellow CSC-151 students and comment on them online.
- Track and Field Home Meet this weekend.
Wellness
- Tuesday, 8 April 2025, 12:15–12:50 p.m., GCMoA.
Yoga in the Museum.
- Tuesday, 8 April 2025, 4:30–6:30 p.m.,
BRAC P103 (Multipurpose Dance Studio).
Wellness Yoga.
- Thursday, 10 April 2025. ???. ???.
Forest Bathing.
- Friday, 11 April 2025, 6:00 p.m.–8:00 p.m., Aux Gym.
Badminton Club (Smash that bird!)
- Friday, 11 April 2025, 9:00 p.m., Noyce Elbow.
Nerf at Noyce.
- Saturday, 12 April 2025, 4:00 p.m.–6:00 p.m., Aux Gym.
Badminton Club (Smash that bird!)
- Tuesday, 15 April 2025, 5:00–6:00 p.m., HSSC Atrium.
Therapy Dogs.
- Tuesday, 15 April 2025, 7:15–8:15 p.m., HSSC Atrium.
Therapy Dogs.
Misc
- Tuesday, 8 April 2025, 7:00–8:00 p.m., Science 3820.
Mentor Session
- Wednesday, 9 April 2025, Noon–1:00 p.m., HSSC A2231 (Auditorium)
Community Forum
- “Weekly discussion on legal protections and recourse on issues
that higher education and Grinnell College face.”
- Also online.
- This week: Karen Edwards on Immigration Regulations.
- Sunday, 13 April 2025, 7:30–8:30 p.m., Science 3819.
Mentor Session
Other good things
These do not earn tokens, but are worth your consideration.
Upcoming work
- Monday, 7 April 2025
- Tuesday, 8 April 2025
- Wednesday, 9 April 2025
- Quiz: Diagramming structures (paper only)
- Makeup quiz: List recursion
- Makeup quiz: Tracing
- Thursday, 10 April 2025
- Friday, 11 April 2025
- Sunday, 13 April 2025
- Monday, 14 April 2025
- Sunday, 20 April 2025
- Submit first redo for MP6 on Gradescope (I hope)
- Submit second redo for MP4 on Gradescope
- Submit second redo for MP5 on Gradescope
- Friday, 16 May 2025
- Submit final redo for MP1 on Gradescope
- Submit final redo for MP2 on Gradescope
- Submit final redo for MP3 on Gradescope
Pairs and pair structures
The mentors asked me to give you a quick summary.
Some basic principles.
- Any time you have a
cons
, draw a cons cell (pair).
- Each box in the cons cell can hold ONE thing (a null or an arrow)
- Any time you have a list of length
n
, draw n
cons cells in
sequence, with a null at the end. Draw downward arrows to each value.
in the list (except for nulls).
- For any explict nulls, draw a slash.
Example,
'((a b ()) c (d e) () ((f)))
Questions
Questions
Administrative
Will we have another chance after the final redo for a mini project?
Nope. Original. First redo. Second redo. Ultimate redo.
Will we have a redo for MP9?
Nope. It’s all or nothing. But it has a very clear rubric which focuses
primarily on “do this minimal stuff in this amount of time”.
It’s also a (self-formed) group project.
Mini-project 7
In mini-project 6, we needed to use local bindings to avoid identical
recursion, which makes things VERY slow. Do we have the same issue on
mini-project 7. If so, can you give an example?
I don’t believe so. We’ll mostly use direct recursion here.
How should we implement enhance-color
?
For each position, find the neighboring pixels (including the pixel
at that position), find their average, call (enhance-color pixel average)
.
Vectors
Other
Vectors
;;; (vector-increment-odd! vec) -> void
;;; vec : (vector-of exact-integer?)
;;; Add one to all the odd numbers in the vector.
;;;
;;; E.g.,
;;; > (define vec (vector 1 2 3 4 5))
;;; > (vector-increment-odd! vec)
;;; > vec
;;; > #(2 2 4 4 6)
(define vector-increment-odd!
(lambda (vec)
(vector-increment-odd-helper! vec 0)))
;;; (vector-increment-odd-helper! vec index) -> void
;;; vec : vector-of exact-integer?
;;; index : exact-integer? (in the appropriate range)
;;; Add one to all the odd numbers in the vector starting at the
;;; the given index and going to the end.
(define vector-increment-odd-helper!
(lambda (vec index)
(cond
[(>= index (vector-length vec))
(void)]
[else
(when (odd? (vector-ref vec index))
(vector-set! vec index (increment (vector-ref vec index))))
(vector-increment-odd-helper! vec (+ index 1))])))
Note that we prefer not to explicitly write void
, so we could also
use a when
here.
(define vector-increment-odd-helper!
(lambda (vec index)
(when (< index (vector-length vec)) ; we're checking whether or not to continue
(when (odd? (vector-ref vec index))
(vector-set! vec index (increment (vector-ref vec index))))
(vector-increment-odd-helper! vec (+ index 1))])))
Semantics of when
(when (TEST)
consequent1
...
consequentn)
- Evaluates the TEST.
- If the TEST holds (evaluates to a truish value), we evaluate each of the
consequents in turn and return the value of the last one.
- If the TEST fails (evaluates to false), we return NOTHING (
void
).
Lab
Today’s lab is Vectors, continued.