Functional Problem Solving (CSC 151 2015S) : EBoards

CSC151.01 2015S, Class 12: A Design Perspective


Overview

Preliminaries

Admin

Upcoming Work

Extra Credit Opportunities

Academic

Miscellaneous

Peer Support (Morning Section)

Recommended, But no EC

Questions

What's the difference between a drawing and an image?

A drawing is a conceptual thing; it's a collection of colored ellipses and rectangles. An image, in contrast, is a reference to GIMP's rendering of something visual.

How many test is enough?

Make sure that you cover all the cases, but each test can cover multiple cases. I would guess that ten different tests would suffice.

How many tests should we include?

For the test suite problem (#5), I want to see all of your tests.

For the others, it's still probably nice to see your experiments, but not required.

Do we make our test suite specific to our implementation?

No. Test suites are intended to test any procedure that tries to meet the given requirements/expectations.

About Quiz 3

Problem 1: Find the difference between a number and the square of its square root

    (define error-root-squared
      (lambda (number)
        (- number (square (sqrt number)))))

    (define error-root-squared
      (lambda (x)
        (- x (* (sqrt x) (sqrt x)))))

    (define error-root-squared
      (lambda (val)
        (- val (expt (sqrt val) 2))))

Problem 2: Given lots of weird code, figure out what it does.

First thing

    (define circ
      (hshift-drawing 0.5 (vshift-drawing 0.5 drawing-unit-circle)))

Telling the difference between values and procedures

    (define sam 2)
    (define prof-rebel (lambda (x) (- x 10)))

    (define shape
      (lambda (h v)
        (hshift-drawing h
                        (vshift-drawing v
                                        (hscale-drawing h
                                                        (vscale-drawing v
                                                                        circ))))))

Last part

    (define munge!
      (lambda (image)
        (drawing-render! (shape (* 1/3 (image-width image))
                                (* 1/3 (image-height image)))
                         image)))

* Procedure or value? Procedure * Parameters/inputs, image * Produces/output * Suppose I give it an image (say the 640x400 image we have on the screen). What's the first thing it does? Computes 1/3 of the width. Computes 1/3 of the height.

A bit about design

A bit about color theory

Exploring some images and design spaces