Week 5

Ch. 8: Processing Tables with Nested Functions

  • Announcement:
    • Coaching Hours posted!
    • I'm grading assignment 2 (available soon in Gradescope)

  • Reminders:
    • Check Campuswire regularly for important and timely class announcements, like coaching hours

    • Lab 4:
      • quite a few people haven't handed it in yet
      • if you're still finishing up / need to be checked off, please see me during office hours (or see one of our coaches)
      • no late penalty, but please finish ASAP (no later than this Thursday)

    • Assignment 3: due this Thursday evening, 11:59pm

    • Exam 1 Reminders:
      • This Friday: October 1st, during lab
      • Review: Thurs

  • Processing Tables
    • Phyllis's notes:
      • review of passing functions as parameters to other functions, including nested functions (this is not in Ch. 8, but it is a powerful technique)
      • viewable/runnable in Copy of lec09.arr
      • zoom recording of lecture Passcode: L5YZmy6? (possibly useless, since I forgot to share the screen and did a lot of white-board work during class – sorry!)

Review and Promises for Midterm

  • Logistics:

    • 75 points
    • designed the length with a 75-minute lecture in mind
    • actually have 120 minutes for our lab, so time should not be an issue
    • budget your time

  • Reference notes (from the Exams section of the syllabus):
    • you may refer to an 8.5×11-inch piece of paper, double-sided, with anything written (or typed) on it that you want.
    • preparing this sheet of notes is an excellent way to study, encouraging you to consider what’s important that you will want to refer to.

  • You are on your honor:
    • we will ask you to attest that you have not discussed, and will not discuss, the contents of the exam with anyone until everyone has taken the exam.
    • we will let you know as soon as all students have taken the exam

  • Topics:

    • You are generally responsible for the material in
      • chapters 1 through 8 of the DCIC text
      • lectures
      • labs 1–4
      • assignments 1–3

  • Exam outline: not finalized yet!

    • 6 questions, points for each question will be indicated
    • sample questions shared in CPO here

    • Problem 1 (15 points) Pyret expressions. Given a series of Pyret expressions, indicate either what each expression evaluates to, or whether it results in an error. Expressions may involve:
      • values of type Number, String, Boolean (no Image values)
      • functions that take and return those types of values
      • operations/operators over those types of values
      • parenthesized expressions
      • named values of the form NAME = EXPRESSION
      • if-else, and if-else if-else expressions

    • Problem 2 (5 points) Fixing a function. Given a function with problems, identify and fix the problems.
      • identifying the problems may involve carefully reading the function header, docstring, examples, and body of the function
      • if the body and/or tests don't match the behavior described in the docstring, fix whatever is wrong so they do

    • Problem 3 (6 points) Incomplete function: missing examples in where: clause.
      • fill in missing examples–enough to fully test the function

    • Problem 4 (10 points) Incomplete function: missing body.
      • this time you are given the where“ clause for a function, but the rest of the function is missing!
      • fill in the missing function header, docstring, and function body

    • Problem 5 (10 points) Reading and understanding code. Given a function:
      • indicate which tests pass or fail
      • briefly describe (in words, not code) what you would need to change to make all of the tests pass

    • Problem 6 (29 points) Table Processing. Multi-part question. Given a table, and a function that takes a row from the table:
      • a. (2 points) fill in the expected return values in the where clause of the function
      • b. (3 points) write the docstring for the function
      • c. (4 points) write an expression to access the value in a particular row and column of the table
      • d. (6 points) write an expression that involves some form of table processing to compute/locate a particular value within the table
      • e. (6 points) given a table expression, show the resulting table
      • f. (8 points) write a predicate function that takes a row of the table and determines whether that row satisfies (returns true) the given criteria.
  • Midterm 1
  • No lab, but we'll still meet in SC 309 at usual lab time for the test