Functional Problem Solving (CSC 151 2016S) : EBoards

CSC151.02 2016S, Class 53: Project Assessment: Images


Overview

Preliminaries

Admin

Reminders

Upcoming Work:

Extra Credit

Academic / Artistic

Peer

Regular Peer

Misc

Questions

Is there a reason you gave us avec-set! and avec-get?

Mostly to help you think about recursion over association vectors. You will not use them directly in your solution.

In solving problems 1 and 2, should we use the $cons idea from exercise 2 on the lab on analyzing procedures.

Yes. Here's the important code.

(define car-counter (counter-new "car"))
(define cdr-counter (counter-new "cdr"))
(define cons-counter (counter-new "cons"))
(define null?-counter (counter-new "null?"))

(define $car
  (lambda (lst)
    (counter-count! car-counter)
    (car lst)))
(define $cdr
  (lambda (lst)
    (counter-count! cdr-counter)
    (cdr lst)))
(define $cons
  (lambda (val lst)
    (counter-count! cons-counter)
    (cons val lst)))
(define $null?
  (lambda (val)
    (counter-count! null?-counter)
    (null? val)))

I seem to have null's in the middle of my vector on problem 2.

Then you probably need to shift values down to fill those in. A separate helper may be useful.

You do not have to use this strategy; There are other ways to solve this that are more efficient.

Should we insert comments to explain what our code is doing?

Sure.

Do you have hints on working on problem 3?

The types of the parameters should be obvious. (Look at how they are used.)

When you plug in appropriate sample values, you'll see what the procedure does.

Some careful thought should explain what indiana does.

I'd suggest making wisconsin a separate procedure so that you can experiment with it.

Why can't I just use read for problem 4?

Because read reads too much. See my sample file.

    > (define source (open-input-file "/home/rebelsky/Desktop/morewords.txt"))
    > (read source)
    'SamR
    > (symbol->string 'SamR)
    "SamR"
    > (read source)
    '(who often writes parenthetical remarks)

How do we convert characters to strings?

Read the reference page.

How much extra credit have we accumulated on this exam?

Five points, so far.

Reviewing images: The "big picture"

Reviewing images: Procedures for doing individual images

Normal procedures.

Updated procedures.

Image review

Debrief, if appropriate