EBoard 16: Pause for breath - review of basics and functions (Section 1)
Please follow the standard start-of-class routine.
Warning! You are being recorded (and transcribed) (provided the technology
is working correctly).
Approximate overview
- Administrative stuff
- Q&A
- Project / Review
Administrative stuff
Introductory Notes
- As I indicated in email, I am using this week for review (for some students)
and a project (for others). I hope this helps everyone get caught up in
the class.
- There is no shame in needing help or asking questions.
- Making this change meant that I needed to cut two learning assessments.
We will still cover the topics (documentation and program style), but I
won’t test you on them.
- There are no new LA topics this week!
- LA times this Friday (across all sections). Feel free to take LAs
during any of these times. (You may attempt each of this week’s LAs
only once.)
- 7:30–8:00, 8:50–9:20, 10:20–11:30, 3:30–4:30.
- For section 1 only: This Friday will approximately follow last Friday’s
model. That is, you may take LAs from 7:30–8:00, we’ll meet at 8:00
to go over administrative materials. We’ll then split up between those
who are doing review and those who are working on projects. At 8:50,
we’ll break for quizzes.
Peer educators
There’s been some confusion on the types of peer educators for CSC-151,
their roles and responsibilities, and the names we associate with each.
- Mentors. The peer educators who help out during classes .
- Mentor Sessions. The sessions they run twice per week. These
sessions are intended to help you better master the material and
prepare for LAs.
- Evening Tutors. The peer educators who hang out in this room or 3815
Sunday through Thursday night. They can help with homework and answer
questions about various topics.
- Evening Tutor Hours. The times they are here.
- Individual Tutors. Peer educators who meet with individual students
or small groups once per week to go over whatever those students need
help with. We generally won’t assign individual tutors unless (a)
you ask for one, (b) you’ve been attending mentor sessions and turning
in work, and (c) you meet with SamR.
Some common notes from MP2
- Style and following conventions are important.
- Documentation belongs immediately above the documented functions.
- Documentation has a standard form.
- Indent with Ctr-I.
- Break lines apart sensibly.
- If you’re going to submit something you know is incomplete, please let the grader know.
- A note at the top that says “I realize that I don’t have good (any?)
answers to these problems” makes their jobs easier.
- All question marks should be replaced, both in code and documentation.
Upcoming work
- Due Thursday, 2026-10-06
- Mini-project 1 redo
- When submitting a mini-project redo, please include a file
called
CHANGES.txt that describes what you’ve changed.
- Due date extended because this is a review week.
- On Friday, 2026-09-09
- Makeup Quiz/LA on collaboration
- Makeup Quiz/LA on lists and list operations
- Makeup Quiz/LA on conditionals
- Makeup Quiz/LA on compose, cut, and section
- Makeup Quiz/LA on tracing
- Makeup Quiz/LA on decomposition
- Makeup Quiz/LA on procedures
- Due Sunday, 2026-10-11
- Due Tuesday, 2026-10-13
- Due Tuesday, 2026-10-27
- Mini-project 2 redo
- Submit redo on Gradescope (forthcoming)
- When submitting a mini-project redo, please include a file
called
CHANGES.txt that describes what you’ve changed.
- Please add the following line to the top of your file.
(export ...).
Upcoming activities
Scholarly
- Monday, 5 October 2026, 4:15–5:15 p.m., HSSC 1325.
AI and the Future of Democracy Highest Recommendation
- Tuesday, 6 October 2026, Noon–1:00 p.m., JRC 224C (I think).
CS Table: Google Zero
- Wednesday, 7 October 2026, 4:30–5:30 p.m., GCMoA.
Robert Gehorsam: The Transformation of Art and Technology: How They Feed Each Other’s Creativity. New
- Thursday, 8 October 2026, 11:00 a.m.–noon, JRC 101.
Scholars’ Convocation: Alan Schrift: From the Origins of the Grinnell College Center for the Humanities to the Past and Current Crises of the Humanities
In this talk, Robert Gehorsam ’76 will reflect on his own career in media and digital technologies to explore how artists and technologists shape both creativity and technological innovation for each other. Technology is not only something that happens to artists and their processes, it is often created as a result of an artist’s desire to create something new. We’ll look at how digital technologies have shaped existing forms such as film and music, but also explore how the digital world can give rise to entirely new forms such as virtual reality and games.
Bio: Robert Gehorsam ’76 (Religious Studies and English) has had a career that spans book publishing, the computer game industry, educational technology, and policy. He currently co-leads two organizations — a convening entity that explores the intersections of culture, society, networks, and societal well-being, and a new initiative centered on technology and democratic innovation. He is a co-author of The Carbon Almanac, a best-selling book on climate change, and currently teaches a short course at the Wilson Center on Entrepreneurship and Social Change.
Artistic/Cultural
- Any day. Visit the GCMOA for at least 30 minutes.
Multicultural
- Friday, 9 October 2026, 4:10–5:00 p.m., HSSC N1170
Middle of Everywhere (Somewhere)
- Saturday, 10 October 2026, 3:00–5:00 p.m., JRC 101.
Walking Tacos with SOL
Peer
Musical, theatric, sporting, academic, and similar events involving this
section’s students are welcome.
Wellness
- Monday, 5 October 2026, 8:00–9:00 p.m., Prayer Garage.
Meditation Group
- Tuesday, 6 October 2026, 4:30–6:00 p.m., Bear P103.
Wellness Yoga
- Tuesday, 6 October 2026, 5:00–8:00 p.m., HSSC North Atrium.
Therapy Dogs
- Wednesday, 7 October 2026, 11:00 a.m.–1:00 p.m., JRC 1st Floor Lobby.
The return of Mom Hugs
- Thursday, 8 October 2026, 11:00 a.m.–3:00 p.m., Goodnow 2nd.
Visit the Ombuds for Ombuds Day
- Get swag.
- Bring a question for better swag.
- Tell Deborah that I sent you.
- Monday, 12 October 2026, 8:00–9:00 p.m., Prayer Garage.
Meditation Group
- Wednesday, 14 October 2026, 4:15–5:45 p.m., Undisclosed Location.
Forest Bathing
Misc
- Tuesday, 6 October 2026, 4:15–5:15 p.m., HSSC 1231.
Semester at CERA information program
- Wednesday, 7 October 2026, 8:00–9:00 p.m., Science 3820.
Mentor Session
- Thursday, 8 October 2026, 4:00–5:15 p.m., Noyce 3821.
CS Major Information Session
- We should have snacks beforehand.
- Thursday, 8 October 2026, 8:00–9:00 p.m., Science 3820.
Mentor Session
Other good things
These do not earn tokens, but are worth your consideration.
- Friday, 9 October 2026, 7:00–9:00 p.m., Darby.
Volleyball vs. Knox
- Saturday, 10 October 2026, 1:00–3:00 p.m., Darby.
Volleyball vs. Illinois
Questions
Administrative questions
Review
- Goal of course: Learn how to express computational solutions to problems
- We’re using an artificial language (Scheme/Scamper) to communicate with
the computer.
- Syntax - how you write things. (Lots of parens.)
- Vocabulary - mostly names of functions.
- Semantics - how we assign meaning to things.
- We need to be precise in the way we write in this language.
- We need to know the vocabulary well.
- Key to writing computational solutions: expressions and functions
(also some other things, like definitions)
- There are two kinds of basic expressions in Scheme
- Basic Values: 4, “hello”, #\x
- Compound expressions:
(function arg1 arg2)
- About parentheses
- Can we use parentheses to group in Scheme? No. Parentheses almost
always signify “This is a function call/compound expression.”
- There are a few cases in which parentheses do not signify “this is
a function call”
- With
(define NAME EXPRESSION) - we’re not necessarily computing
anything, we’re just assigning a name to a value for convenience.
- We also use parens around lambdas and around the parameters for
lambdas.
- About functions
- Are there places functions can appear other than immediately after
an open parentheses? Yes! They can appear without parentheses as
arguments to
l-s, r-s, map, apply, … [Wednesday/Friday]
- A value is something that cannot be simplified anymore. An argument may
be a value or it may be an expression that we use to compute a value.
(substring (string-append "hello" "world") (+ x 2) (+ x 5))
- We need differents kinds of values to compute with. We use the term “type”
for “kind of value”. We’ve encountered a bunch of types so far in 151.
- Numbers, including integers and real numbers
- Characters - The building blocks of language (or at least strings)
- Strings - Sequences of characters. Text to compute with.
- Booleans - True, False, and nothing in between, used for maknig decisions
- RGB colors - Ways to add and manipulate colors in image-based programs
- HSV colors - Another way to play with colors
- Lists - Sequences of any type of value
- Shapes - Things we draw (or the computer draws)
- Images/Canvases - Things with individual pixels
- When we learn a new type, we should ask ourselves some questions:
- Why do we have the type / how will we use it? For strings: Work with text
- How do we write the basic values in the type? For strings: With quotation marks around them.
- How do we make values in the type? For strings:
(integer->string number)
(list->string list-of-characters)
(make-string count char)
(string char1 char2 char3 ...)
- How does Scamper show them to us? For strings: With quotations marks around them.
- What can we do with them? For strings:
(substring str pos) - Extract the portion of the string starting
at charcter pos.
(substring str pos1 pos2) - Extract the portion of the string starting at pos1 (inclusive) and ending at pos2 (exclusive).
(string-append str1 str2 ...) - Combine the strings together into a single string.
(string-split str splitter) - Splits the string whenever it sees splitter. Returns a list of strings.
- As we noted earlier, we can name things with define statements
(define NAME EXPRESSION)
- Why do I call them “define statements” rather than “define expressions”?
- Most expressions do not affect the rest of the program.
- We can’t put
define statements inside an expression.
- We use expressions and statements differently. Statements tend to
go by themselves, expressions can be nested.
- Note that you get only ONE expression after the name.
- Meaning of define statement: Evaluate the expression; thereafter,
whenever you see the name, you substitute the value of the expression.
- Semantics: How we evaluate expressions.
(+ (* 2 3) (- 5 x))
- If there any variables defined by prior
define statements, substitute
those in.
- Evaluate all the arguments to each function before applying the function
- We usually work left to right.
(define c 3)
(define d 4)
(+ (* c c) (- d (+ c d)))
--> (+ (* 3 3) (- 4 (+ 3 4)))
--> (+ 9 (- 4 (+ 3 4)))
--> (+ 9 (- 4 7))
--> (+ 9 -3)
--> 6
Note: Our model of how to evaluate expressions corresponds directly to
how we trace evaluation.
(define x "Hello")
(string-append "[" (string-upcase x) (make-string 3 #\.) (substring x 1) "]")
--> (string-append "[" (string-upcase "Hello") (make-string 3 #\.) (substring "Hello" 1) "]")
--> (string-append "[" "HELLO" (make-string 3 #\.) (substring "Hello" 1) "]")
--> (string-append "[" "HELLO" "..." (substring "Hello" 1) "]")
--> (string-append "[" "HELLO" "..." "ello" "]")
--> "[HELLO...ello]"
Functions
- What is a function? Something that takes inputs, does some computation, and produces an output.
- We often think of functions as generalizations of expressions we’ve written to accomplish something.
- I might have written
(string-append "[" (string-upcase "sam") "]") and I’d like to do the “uppercase and surround by brackets” for any string, not just “sam”.
- I might have written
(+ 1 (* 2 sams-grade))
- In Scheme, we have one basic way to define functions (and lots of alternatives).
(define NAME
(lambda (PARAMETERS)
EXPRESSION))
(define scale-grade
(lambda (grade)
(+ 1 (* 2 grade))))
- Semantics of function calls: When you call a function, you substitute
the inputs/arguments for the parameter.
(scale-grade 5) -> (+ 1 (* 2 5)) -> (+ 1 10) -> 11
(scale-grade 6) -> (+ 1 (* 2 6)) -> (+ 1 12) -> 13
(scale-grade (scale-grade 2))
--> (scale-grade (+ 1 (* 2 2)))
--> (scale-grade (+ 1 4))
--> (scale-grade 5)
--> (+ 1 (* 2 5))
--> (+ 1 10)
--> 11
When we trace, we’re just precisely thinking through how the computer
determines the result of an expression.
* If there any variables defined by prior define statements, substitute
those in.
* Evaluate all the arguments to each function before applying the function
* We usually work left to right.
* Semantics of function calls: When you call a function, you substitute
the inputs/arguments for the parameter.
Important points from today:
- Parentheses are important. If you use an open paren (other than in a
define or lambda), follow it by a function.
- If you want to use a function, you’ll usually put it immediately after
an open paren. (Exceptions: cut, l-s, r-s, map, …)
- Tracing is just an attempt to understand how the computer evaluates
expressions.
- To succeed in 151, you need to know the vocabulary for diff types.
We’ll do a longer trace next time.
Homework: Try to memorize more functions!