CSC151.01 2014F, Class 30: Preconditions, Revisited
New partners!
Overview
- Preliminaries.
- Admin.
- Lots of work returned.
- Upcoming work.
- Extra credit.
- About meeting with SamR.
- Questions.
- Main Concepts.
- Lab.
Preliminaries
Admin
- Welcome back. I hope you had a wonderful break!
- Congratulations to BM for an interesting writeup:
http://www.grinnell.edu/news/attitude-gratitude
- A correction on my interpretation of College policies on academic
honesty: I told you that if you don't turn in work, then you cannot
be charged for academic dishonesty on that work. While the chair of
the CAS subcommittee on academic dishonesty agreed with me that it was
appropriate to tell you that for my take-home exams, the dean who serves
on that committee told me that that policy does not always apply. So
don't count on it. (I don't expect that you will ever need to count on
that rule, but I don't want to mislead you if you find that you want to.)
- HW 6: If you want to work by yourself or with a particular person, please
let me know by 10 pm tonight using http://bit.ly/151-2014F-partners6.
Otherwise, I will assign you a randomly selected partner.
Work Returned
- HW 5 returned via email.
- Folks aren't documenting.
- But I haven't been reminding you to document.
- You should plan to document on HW 6.
- Quiz 7 returned.
- Each db pic has a number. The images were arranged by number.
- Whenever we hit a bad design in gigls and someone asks why it's not
fixed, my standard answer is "I'm lazy".
- Exam 2 to be returned at the end of class.
- If you needed to invoke "There's more than life", please sign up
for an appointment. (Read through the notes on the exam before
meeting with me.)
Upcoming Work
- Let me know about partners for HW 6:
http://bit.ly/151-2014F-partners6.
- Lab writeup: Problems 3h and 4: http://bit.ly/151-2014F-w30
- Reading for tomorrow.
- Homework 6 (to be assigned on Wednesday), due a week from Tuesday.
- Exam 3, distributed a week from Wednesday, due two weeks from Tuesday.
- Yes, it comes soon after exam 2. But it's the best place in the
schedule for it.
Extra Credit Opportunities
Academic
- CS Extra Thursday: Randomness in Computer Science.
Peer Support
- Football (Saturday at 1pm)
- Swimming scrimmage noon on Saturday in the King
- Karan's radio show 11pm Thursday nights on KDIC
- Evan's radio show 5pm Friday nights on KDIC
- Donna's radio show Sunday midnight on KDIC
On Meeting with SamR
Some of you meet with me regularly. Some of you just asked for help on the
exam. Some of you don't meet with me at all. I hear from our upper-level
students that meeting with me was helpful when they were in 151.
- So, I'm going to leave the room for five minutes and let you talk to each
other about asking me for help in person or via email.
- Tries to accommodate.
- Does give hints, even on exam problems.
- Usually responds quickly (or not at all).
- Sometimes makes changes to assignments/exams.
- Can find other ways to explain.
- Lets you check understanding.
- You can also make a list of things that I can do better in meeting with
students or responding to email, other than magically finding time for
more office hours (or to clean my office).
- Sam doesn't always understand problems via email. And students
don't always understand Sam's overly-verbose answers. So
sometimes in-person meetings are good.
- Sam needs more office hours, particularly hours that accommodate
students who are in sports or other extra-curricular activities
- Email me to help me find other times that might work better.
I'll try.
- Sam (and the class) assume understanding of "big, scary, math".
Questions
Key Concepts
What did you see as the key concepts in the reading?
- Discuss with your partner for two minutes.
- Be prepared to share.
Key concepts:
- Husks and Kernels
- If preconditions aren't met, don't bother doing the work.
- Error messages
- Many error messages are not very helpful.
- We want to make our procedures to generate error messages that might
make sense to the user/client.
- Form for producing error messages
(error "MESSAGE")
.
- We can also put in more parameters to error, and it prints them all
out in red.
- Error also stops computation.
- All about good programming practice and thinking carefully about
preconditions.
Lab
What's going on with the following weird procedure?
(define all-drawings?
(lambda (lst)
(or (null? lst)
(and (drawing? (car lst))
(all-drawings? (cdr lst))))))
It's the wonder of recursion using Boolean values. It's also more concise
(and, arguably, clearer) than something like the following.
(define all-drawings?
(lambda (lst)
(if (null? lst)
#t
(if (drawing? (car lst))
(all-drawings? (cdr lst))
#f))))
Let me know if you need more explanation.
How do I tell if an element is in a list?
Option one: Look at the reference page for list procedures. There are
at least two functions that help you tell.
Option two: You know at a certain point that the value is not in the list.
You could just issue an error message at that point. : It's when
the list is empty.)
What's the format for 6P's?
Three semicolons. One space. The word "Procedure". A colon. A newline.
Three semicolons. Three spaces. The name of the procedure. A newline.
Three semicolons. One space. THe word "Parameters". A colon. A newline.
And so on and so forth.