Approximate overview
Note: You do not get credit if others are supporting you (e.g., if you’re playing at a tennis meet or hosting Lunar New Year). You also don’t get credit for evening tutors.
What’s wrong with the following? (TPS)
(define mentor->section
(lambda (mentor)
(cond
[(string=? mentor (or "Cassandra" "Quang"))
"Section 01"]
[(string=? mentor (or "Hallie" "Nameera"))
"Section 02"]
[(string=? mentor (or "Micah" "Paul"))
"Section 03"]
[else
"Not a mentor"])))
or might be in the wrong place. We should be comparing mentor
to “Cassandra”, comparing mentor to “Quang”, and *then* using or`.
or returns the first truish value, so (or "Cassandra" "Quang") gives
us “Cassandra”or
before the comparison.(quote THING).(list (list 'a 'b) (list 'c 'd) 'e)?'('stuff 'more stuff) is short for
(quote ((quote stuff) (quote more) stuff))(list? (list (list 'a 'b) (list 'c 'd) 'e)) => #t(map list? (list (list 'a 'b) (list 'c 'd) 'e)) => '(#t #t #f)(map list? '((a b) (c d) e)) => #t vs '(#t #t #f)(list? '((quote stuff) (quote more) stuff)) => #t(map list? '((quote stuff) (quote more) stuff)) => '(#t #t #f)(map list? '('stuff 'more stuff)) => '(#t #t #f)apply vs reduce vs map(THING proc lst).reduce is designed for two-parameter procedures. It combines
pairs repeatedly until it has a single value.apply works better for procedures that take an arbitrary number of
parameters. It applies the procedure en masse.map needs to match the number of lists. If there
is only one list, it needs to be a one-parameter procedure. It
applies the procedure to each element separately, creating a new list.reduce does not behave predictably in terms of which
pairs it combines. Hence, the procedure you use with it should work
the same no matter what order things are combined.reduce-left or reduce-right, but you give up
the opportunity for parallelization.What does “match” mean in the regular expression context?
We have a pattern given by the regular expression. We use “match” to mean “corresponds to the pattern” (or vice versa).
What do you mean when you say Kleene was your great grand advisor?
When you do a Ph.D., you have an academic advisor who guides you through the Ph.D. O’Donnell was my advisor. Constable was O’Donnell’s advisor (and therefore my grand-advisor). Kleene was Constable’s advisor (and my great grand advisor). (I use grandparent-like terminology here.) Church was Kleene’s advisor. Church invented “lambda” as a way of writing procedures.
Can we go over regular expressions a bit?
Yes, on Friday, as long as you bring questions.
I have an eight-hour lab tomorrow. Can I have an extension on the SoLA?
Yes. DM me to let me know.
Do we have to do the SoLA in one sitting?
No. There are seven questions. You can do each one at any time. Each question does have a one-hour time limit.
(char-alphabetic? char) determines whether or not char is a letter.(length lst) tells you how many values are in a list(tally-value lst val) tells you how many times val appears in lst.(tally pred? lst) tells you how many things in the list meet the
predicate.