Warning! You are being recorded and transcribed, provided the technology is working correctly.
We are back to the standard start-of-class procedure.
Approximate optimistic overview
Scholarly
Artistic
Multicultural
Peer
Musical, theatric, sporting, and academic events involving this section’s students are welcome.
Wellness
Misc
These do not earn tokens, but are worth your consideration.
When will we get grades on today’s quizzes?
Sam hopes to have those done tonight.
What should we submit for redos?
The updated
.rkt
file.
Any images required by the assignment.
A text (preferably) or PDF file name
CHANGES.txt
(orCHANGES.pdf
) that summarizes what problems you had the first time and what changes you’ve made. It can also beCHANGES.rkt
.
I accidentally opened an LA early because I didn’t understand the timing. Can you help me?
Yes, I can reset them if you DM me.
If I pass today’s makeup tracing quiz, do I have to do it online?
You can only pass in-person tracing quizzes. If you don’t pass today’s, you can try again next week.
What about documentation?
Documentation is Phase 2, so it’s not on this SoLA?
Why does the equality predicate =
not also count as a comparator?
Comparators are supposed to tell you whether one thing comes before another.
=
does not.
Could you go over the not
procedure and its uses?
Sure.
(not expression)
-> Gives the “opposite” result of the expression.
;;; (anything-but-string? val) -> boolean?
;;; val : any?
;;; Returns false if `val` is a string and true otherwise.
(define anything-but-string?
(lambda (val)
(not (string? val))))
I read and reread the truish breakdown and was still confused. What are examples of statements that would result in a truish output? What would produce not false, but then not be true?
(not #f)
is always true,#t
.
However, there are values that are neither
#f
nor#t
. For example,"hello"
or the result of(+ 2 3)
. We consider those “truish”. If we use them as the test/guard in a conditional, instead of an error, we’ll see them treated as if they were true.
Is there a “nothing” value in Scheme and is it truish or false?
Yes. It’s the result of
(void)
and is treated as truish (because it is something other than false).
What do we need to understand when making the distinction between keywords and procedures?
You should understand that the order of evaluation is different (and, preferably, what that order is).
Normal (e.g.,
(+ exp1 exp2 exp3)
): Evaluateexp1
, thenexp2
, thenexp3
, then apply the sum operator.
Lambda (i.e.,
(lambda (params) exp)
): To apply a lambda expression, we substitute the arguments for the parameters in the expression and then evaluate the expression using the rules we’re writing. But if we just write the lambda expression, it does (almost) nothing. It only builds a procedure.
If (i.e.,
(if test consequent alternate)
): Evaluate the test. If the test is truish, evaluates the consequent and returns its value. If the test is false, evaluates the alternate and returns its value.
And (i.e.,
(and exp1 exp2 exp3)
): Evaluateexp1
. If it’s false, stops and returns false. Otherwise, goes on to the next expression. If all of the expressions are truish, returns the value of the last expression.
Or (ie..,
(or exp1 exp2 exp3)
): Evaluate each expression in turn until one of them is truish. Returns that value. If none of them are truish, returns false.
When you get to median-of-three
, you might find min
and max
useful.