Functional Problem Solving (CSC 151 2016S) : EBoards

CSC151.02 2016S, Class 36: Randomized (Unpredictable) Drawing


Overview

Preliminaries

Admin

Reminders

Upcoming Work:

Extra Credit

Academic / Artistic

Peer

Miscellaneous

Regular Peer

Misc

Far in the Future

Other Cool Stuff

Questions

I really want to take the awesome-sounding one-credit course entitled "Social Justice Issues Influencing American Business". But it overlaps with 151. Can I miss four sessions without penalty?

Yes, provided you make up the labs on your own.

I'd really like to take CSC 207 in the fall. Is it possible to do 161 over the summer?

We provide two alternate tracks for 161 over the summer. Neither counts toward the 32 credits in the major, but they do allow you to go on to 207.

You can take the Harvard CS 50 course on EdX. https://www.edx.org/course/introduction-computer-science-harvardx-cs50x

You can use the pre-robots version of CSC 161 and have me give you a test at the end of the summer.
< http://www.cs.grinnell.edu/~walker/courses/161.sp10/>

I'll do my best to answer questions in either context.

We have about a 50% success rate for either option.

Is grading done yet?

No. It appears that all the signs that Minna posts about sleep are correct.

Monday?

I certainly hope so.

Have people started asking good questions about the exam?

Yes.

Can you go over some of them?

Maybe.

I need more than one consequent in an if statement. What do I do?

Use cond or when.

I don't need an alternate in an if statement. What do I do?

Use when.

Can I use list-drop or list-take in solving rdc or rac?

No.

Can cond really do more than one step?

    (define process-list
      (lamda (lst)
        (cond
          [(null? lst)
           (void)]
          [(odd? (car lst))
           (display "It strikes me that ")
           (display (car lst))
           (display " is somewhat odd")
           (newline)
           (process-list (cdr lst))]
          [else
           (process-list (cdr lst))])))

Can you do an example of a named let really quick?

Form

    (let NAME ([PARAM INIT-VALUE]
               [PARAM INIT-VALUE])
      BODY)

Example

    (define tally-odd
      (lambda (lst)
        (let colonel ([tally 0]
                      [remaining lst])
          (cond
            ; NOTHING LEFT
            [(null? remaining)
             tally]

            ; ODD CAR
            [(odd? (car remaining))
             (colonel (+ 1 tally)
                      (cdr remaining))]

            ; EVEN CAR
            [else
             (colonel tally (cdr remaining))]))))
      BODY)

Quiz

Lab

Writeup is 1b.

But you should play with the rest of the lab; it's fun (and may even help you on the exam).