Skip to main content

CSC 151.01, Class 44: Project Work Day

Overview

  • Preliminaries
    • Notes and news
    • Upcoming work
    • Extra credit
    • Questions
  • Quiz
  • Notes on quiz 10
  • Wednesday’s question
  • Work time

News / Etc.

  • Sit with project partners!
  • Free octocat stickers
  • Welcome to any folks here for junior visit day!
  • We’ll use work time for you to chat with your partners. The mentors and I will be available to chat about approaches and more.

Upcoming Work

  • No lab writeup.
  • Reading for Monday: Files in Scheme
  • Project Proposals due Monday evening (sketches due Tuesday).

Extra credit (Academic/Artistic)

  • Met Opera Live in HD: Eugene Onegin. Saturday, April 23. Opera Talk, 11:30 a.m., Opera, noon, Harris Center Cinema

Extra credit (Peer)

  • Vietnamese Food Stall, 6 p.m. - 8p.m. tonight, JRC 2nd.
  • Track and Field, Saturday, the Track (and field), 11am - ??
  • Art House Arts Fest on Sunday, April 23rd. 11 a.m. to 2 p.m.
  • ISO Cultural Evening, Satuday, 7-9 p.m., Harris

Extra credit (Misc)

  • First-year bonfire. Make sure to sing the appropriate verse of American Pie. “And as the flames climbed high into the night, to light the sacrificial rite, I saw __ laughing with delight, the day, the - _.”

Other good things to do

  • Dag Field Day, Saturday, April 29, noon-5pm, in the Club Athletic Field.

Friday PSA

  • You are awesome.
  • So be awesomely moderate.
  • Do not pressure.
  • Get consent.

Questions

What do we do on the last day of class?
Discuss what we should have learned.
Evaluate Sam.
Get a final PSA from Sam
Is the final still optional?
Yes, it replaces your lowest exam grade provided it is higher than your lowest exam grade.
What is the final like?
My, you like to prepare early.
Four questions. Closed book/computer, open one-page-of-notes.
Questions are generally like a really hard quiz.
Coarse grading: 4 right or mostly is an A; 3 is a B, 2 is a C, 1 is a D.

Quiz

Notes on quiz 10

Problem 1

(list (cons 1 1)
      (cons 2 2)
      (cons null null))

Problem 1.5

How will this appear?

Problem 2

(define vector->list
  (lambda (vec)
     (let kernel ([pos (- (vector-length vec) 1)]
                  [list-so-far null])
       (if (< pos 0)
           list-so-far
           (kernel (- pos 1) (cons (vector-ref vec pos) list-so-far))))))

Chart

pos             list-so-far             vec
2               `()                     #(a b c)
1               '(c)                    #(a b c)
0               '(b c)                  #(a b c)
-1              '(a b c)                #(a b c)

### Wednesday's end-of-class question

Here's how most of you wrote `acronym`.

(define acronym (lambda (los) (list->string (map (l-s string-ref 0) los))))


How can you make this even more concise?

_One minute to discuss!_

Two main steps: 

* Taking the first letter of strings in a list (creating a new list)
* Combining them into a single string

Write a procedure that takes the first letter of each string in a list 
and returns a new list of just those letters.

(define first-letters (lambda (los) (map (o car string->list) los)))

(define first-letters (lambda (los) (map (r-s string-ref 0) los)))


The second is more efficient, since turning a string into a list is
inefficient, and pointless, since we don't care about most of the list.

Can we write the second version of `first-letters` more concisely?

(define times2 (lambda (x) (* 2 x))) (define times (l-s * 2))


(define first-letters (l-s map (r-s string-ref 0)))


Two things: first-letters then list->string.

(define acronym (o list->string first-letters)) (define acronym (o list->string (l-s map (r-s string-ref 0)))) ```

Work Time