Overview
snowman-with-hat
What happens when I can’t take a quiz on the normal day?
If you know in advance, we negotiate another day (typically Thursday or Monday).
If you don’t know in advance, you take it the next day that you are in class.
Can I have an individual tutor?
Probably. Make sure that you use the mentor sessions. You’ll also need to have a quick chat with me and with Sarah Dahlby Albright, our Peer Education coordinator.
How do I tell the value of what I’ve defined in the definitions?
Type the name
Type things that extract values (e.g.,
(image-width rect)
)
Composition didn’t work in the bottom panel?
You need to require the
loudhum
library.
I can’t require loudhum on my computer.
Yup. The magic incantations
/home/rebelsky/bin/csc151/setup
installed it in MathLAN. I will provide more complicated instructions for other computers.
What about the images library?
That’s part of standard Racket, so it’s always available (as long as you require it).
How do you make a variable out of a user input?
We’re not using that model right now.
What might we write on flash cards?
Front: What is the format of a “standard” procedure in Racket? Back:
(define proc (lambda (params) body))
.
Front: What is
(string-append "apple" "banana")
? Back: “applebanana”, with no space.
Front: What are the seven basic parts of an algorithm? Back: Built-in values (and operations). Conditionals. Sequencing. Variables (also identifiers), Repetition. Subroutines. Input/output.
Front: What do we use variables for? To name values, leading to clarity in our program.
What is the most important thing we’ve learned this far?
You are wonderful people. Please take care of yourselves.
Seven parts of an algorithm.
Getting the syntax right takes time.
Scheme expressions have the form
(procedure-name parameter parameter)
, as in(+ 2 3)
. The operation/procedure comes first. The paren almost always signals that the next is a procedure.(2 + 3)
will yield “2 is not a procedure”. The exception is when we have an apostrophe (tick), before the open paren, in which case we’re just defining (or reading) a list.
Scheme expressions are (usually) evaluated inside-out.
Can we draw a curve or line?
Which comes first, width or height?
width is like x, so it comes first.
Will we always spend so much time on Q&A at the beginning of class?
Probably not. But it’s early enough in the semester that it’s worthwhile.
Ten minutes.
Reminder: A chance for you and me to see what is and is not making sense.
If you finish early, check your answers or sit and meditate quietly. (After all, we have so little time for quiet reflection in life.)
You may also leave to use the restroom or fill up your water bottle or something similar.
How did you write subtract3
using lambda
?
(define subtract3
(lambda (n)
(- n 3)))
How did you write subtract3
using o
?
Assume sub1
is defined.
(define subtract3 (o sub1 sub1 sub1))
How did you write subtract3
using section
?
(define subtract3 (section - <> 3))
Which do you prefer?
Writeup: 2d. Send to csc151-01-grader. Subject: “CSC151.01 Writeup for class 4 (Your Names)”
Apologies for a too-long lab (or a too-long Q&A session).
Some issues with naming …
(define color-square
(lambda (color)
(square 10 'solid color))) -> Use whatever value given to color-square
(color-square "blue") -> Use "blue" verbatim, which DrRacket knows
(color-square 'blue) -> Use 'blue verbatim, which DrRacket knows
(color-square blue) -> Look for the value of the variable blue