Functional Problem Solving (CSC 151 2014S) : EBoards

CSC151.02 2014S: Extra Session 2


Overview

Admin

Questions

What is on tomorrow's quiz?

Quizzes are cumulative, but tend to focus on recent topics.

This week's "recent topics" are drawings as values, procedures. We'll probably either give you a drawing and ask for code, or give you a code and ask for the drawing. We'll also ask you to write a procedure.

We won't ask anything hard about modulo, although mod is useful for cycling through values.

Why did you make us learn symbols if we're not really using them?

Um ... tradition?

Could you explain a bit more about modulus?

I think of modulus as a nice way of cycling through numbers. We count up to the modulus. When we reach the modulus, we go back to zero, without writing the modulus

(modulo x y)

x:             ... -5 -4 -3 -2 -1  0  1  2  3  4  5  6  7  8 ...
(mod x 3)           1  2  0  1  2  0  1  2  0  1  2  0  1  2
(mod x 4)                          0  1  2  3  0  1  2  3  0 ...

Alternately: It's like "positive remainder"

Can you explain the image-show thing?

We will be working with more than one model of what a picture is.

An image is something we can easily display. And we present them as numbers.

Drawings need to be converted to images with drawing->image.

How about with lambda?

Eventually, we get sick of typing image-show and drawing->image, so we define a procedure to help out.

    (define small-preview
      (lambda (drawing)
        (image-show (drawing->image drawing 100 100))))

Samuel A. Rebelsky, rebelsky@grinnell.edu

Copyright (c) 2007-2014 Janet Davis, Samuel A. Rebelsky, and Jerod Weinman. (Selected materials are copyright by John David Stone or Henry Walker and are used with permission.)

Creative Commons License

This work is licensed under a Creative Commons Attribution 3.0 Unported License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc/3.0/ or send a letter to Creative Commons, 543 Howard Street, 5th Floor, San Francisco, California, 94105, USA.