Skip to main content

CSC 151.01, Class 20: Anonymous Procedures and Local Bindings

Overview

  • Preliminaries
    • Notes and news
    • Upcoming work
    • Extra credit
    • Friday PSA
    • Questions
  • Quiz
  • Lab

News / Etc.

  • Continue partners!
  • Both drawings and values and Monday’s topic benefit from drawing diagrams, so I brought you graph paper.
  • A mentor told some of you that I was serious, not angry, when discussing my academic honesty concerns. She was wrong. Although I was serious, I am also angry. I am not angry at anyone; we had a clear misunderstanding. I’m just angry that it happened.
  • I apologize for forgetting to tell you to do the reading on local bindings.

Rotating reminders

  • Ask questions via email! I’m always happy to (try to) answer questions via email. There is no need to apologize when sending me questions. If I take too long to answer, send another email (or even text, if it’s a reasonable hour).
  • Visit our store! We have office supplies in the commons. Price is free will donation.

Upcoming Work

Extra credit (Academic/Artistic)

  • Screenagers documentary, 10 am, Saturday, Strand
  • Met Opera Live in HD showing of Rusalka, Saturday, Feb. 25. Talk 11:30-noon, opera noon-3pmish.
  • CS Table, Tuesday at noon: ???
  • W. Kamau Bell, Tuesday at 6pm, Harris.
  • Prazak Quartet, Tuesday, 28 February 2017, 7:30 p.m., Herrick.
  • CS Extras, Thursday at 4:15 pm, Sam’s research

Extra credit (Peer)

  • Jazz band concert Friday at 7:30 p.m. in Sebring-Lewis.
  • Ritalin Test squad, 2-4pm Saturday, Bucksbaum, The Wall
  • Punc lub Saturdays at 4pm, in the Secret Younker Lounge.

Extra credit (Misc)

  • Host a prospective student NEXT WEEKEND. (March 5, April 8, April 23)

Good things to do (no EC)

  • Womens Bball today (and, we hope, tomorrow)
  • Diving regionals this weekend (2pm today, noon Saturday)
  • Last chance swimming, 10am-noon Sunday.

Friday PSA

  • Take care of yourself.
  • Take care of others.

Questions

What’s the difference between drawing-compose and drawing-group?
One of them takes a list of drawings, the other takes individual drawings. Both combine all of those drawings into one drawing.
How should I approach the next test so that I do better?
Keep track of vocabulary, syntax, common phrases. There is benefit to organizing it yourself. E.g., (image-variant image (....))
Approaching problems. “What have I seen that is similar to this, and what did I do in that case?” “What tools will help me solve this problem?” Try doing it by hand.
Ask Sam questions and tell him when his answers are insufficient.
Don’t forget that I sent you general notes on the last exam. Those notes include answers to every problem.
Could you explain l-s and r-s (pronounced “left-section” and
“right section”?
; (l-s + 2) => (section + 2 <>)
(r-s + 2) => (section + <> 2)
Do l-s and r-s only work with two-parameter procedures?
Yes. If you try a one-parameter or a three-parameter, I have no idea what will happen. Some random gunner says you will get an error.
Why don’t we write if expressions without alternatives?
Because we have when for that purpose.
There is an assumption that an if expression returns a value. What value does (if (< 2 1) 2) return? How about (+ 5 (if (< 2 1) 2)).
Um?
Yup
When should we use when?
If you have no alternative case in your logic.
If you have more than one consequent.
Use when
Where do the answers in the exam notes come from?
I write them before grading.
I update after looking at your solutions.
If we write something that is supposed to return a color, but is making
choices between colors, what should we use?
if or cond, but not when.
Look, I read the review session eboard. Aren’t you proud?
Yes. Everyone should.

Quiz

  • Fun!

Lab

Why is the line upside-down?
In most graphics programs, x increases as you go downward.
Why do we have check-drawings?
So that you don’t have to keep typing (image-show (drawing->image (drawing-compose ...))).
When you write the same thing again and again, write a procedure that does it for you.
check-drawings also figures out the appropriate size for the image.
What is modulo?
Something exactly like remainder for positive dividends.
(modulo x y) is (+ y (remainder x y)) for negative x.
What is drawing-hshift?
Almost like hshift-drawing, but with the arguments reversed.